xuexiangjys / XUI

💍A simple and elegant Android native UI framework, free your hands! (一个简洁而优雅的Android原生UI框架,解放你的双手!)
https://xuexiangjys.github.io/XUI/
Apache License 2.0
4.91k stars 839 forks source link

在显示底部弹窗BottomSheet时,发生闪退 #187

Closed SuperReally closed 2 months ago

SuperReally commented 2 months ago

版本 com.github.xuexiangjys:XUI:1.2.1 问题描述,在界面调用底部分享窗口方法时,会闪退: BottomSheet.BottomGridSheetBuilder builder = new BottomSheet.BottomGridSheetBuilder(TzDetail.this); builder.addItem(R.drawable.img_wx, "分享到微信", 0, BottomSheet.BottomGridSheetBuilder.FIRST_LINE) .addItem(R.drawable.img_cof, "分享到朋友圈", 1, BottomSheet.BottomGridSheetBuilder.FIRST_LINE) .addItem(R.drawable.img_qq, "分享到QQ", 2, BottomSheet.BottomGridSheetBuilder.FIRST_LINE) .addItem(R.drawable.img_qq_s, "分享QQ空间", 3, BottomSheet.BottomGridSheetBuilder.SECOND_LINE) .addItem(R.drawable.img_weibo, "分享微博", 4, BottomSheet.BottomGridSheetBuilder.SECOND_LINE) .addItem(R.drawable.svg_share_msg, "分享私信", 5, BottomSheet.BottomGridSheetBuilder.SECOND_LINE) .setOnSheetItemClickListener((dialog, itemView) -> { dialog.dismiss(); int tag = (int) itemView.getTag();

            }).build().show();

报错信息: E/CrashReport: android.view.InflateException: Binary XML file line #8 in com.really.tcia:layout/xui_bottom_sheet_grid_item: Binary XML file line #8 in com.really.tcia:layout/xui_bottom_sheet_grid_item: Error inflating class com.xuexiang.xui.widget.dialog.bottomsheet.BottomSheetItemView Caused by: android.view.InflateException: Binary XML file line #8 in com.really.tcia:layout/xui_bottom_sheet_grid_item: Error inflating class com.xuexiang.xui.widget.dialog.bottomsheet.BottomSheetItemView Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at android.view.LayoutInflater.createView(LayoutInflater.java:879) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1035) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:986) at android.view.LayoutInflater.inflate(LayoutInflater.java:680) at android.view.LayoutInflater.inflate(LayoutInflater.java:545) at com.xuexiang.xui.widget.dialog.bottomsheet.BottomSheet$BottomGridSheetBuilder.createItemView(BottomSheet.java:663) at com.xuexiang.xui.widget.dialog.bottomsheet.BottomSheet$BottomGridSheetBuilder.addItem(BottomSheet.java:645) at com.xuexiang.xui.widget.dialog.bottomsheet.BottomSheet$BottomGridSheetBuilder.addItem(BottomSheet.java:616) at com.really.tcia.Activity.Tz.TzDetail.shareTzToX(TzDetail.java:257) at com.really.tcia.Activity.Tz.TzDetail.lambda$initChildView$4$com-really-tcia-Activity-Tz-TzDetail(TzDetail.java:243) at com.really.tcia.Activity.Tz.TzDetail$$ExternalSyntheticLambda9.onClick(Unknown Source:2) at android.view.View.performClick(View.java:7807) at android.view.View.performClickInternal(View.java:7780) at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0) at android.view.View$PerformClick.run(View.java:31401) at android.os.Handler.handleCallback(Handler.java:958) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:222) at android.os.Looper.loop(Looper.java:314) at android.app.ActivityThread.main(ActivityThread.java:8786) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:565) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1090) Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 16: TypedValue{t=0x2/d=0x7f04094c a=-1}, theme={InheritanceMap=[id=0x7f1202d4com.really.tcia:style/Theme.Tcia, id=0x7f120283com.really.tcia:style/Theme.AppCompat.Light.NoActionBar, id=0x7f12027dcom.really.tcia:style/Theme.AppCompat.Light, id=0x7f12005acom.really.tcia:style/Base.Theme.AppCompat.Light, id=0x7f1200b5com.really.tcia:style/Base.V28.Theme.AppCompat.Light, id=0x7f1200b2com.really.tcia:style/Base.V26.Theme.AppCompat.Light, id=0x7f1200accom.really.tcia:style/Base.V23.Theme.AppCompat.Light, id=0x7f1200aacom.really.tcia:style/Base.V22.Theme.AppCompat.Light, id=0x7f1200a0com.really.tcia:style/Base.V21.Theme.AppCompat.Light, id=0x7f1200b8com.really.tcia:style/Base.V7.Theme.AppCompat.Light, id=0x7f120170com.really.tcia:style/Platform.AppCompat.Light, id=0x7f12017bcom.really.tcia:style/Platform.V25.AppCompat.Light, id=0x1030241android:style/Theme.Material.Light.NoActionBar, id=0x1030237android:style/Theme.Material.Light, id=0x103000candroid:style/Theme.Light, id=0x1030005android:style/Theme], Themes=[com.really.tcia:style/Theme.Tcia, forced, com.really.tcia:style/Theme.AppCompat.Empty, forced, android:style/Theme.DeviceDefault.Light.DarkActionBar, forced]} at android.content.res.TypedArray.getDimensionPixelSize(TypedArray.java:792) at android.view.View.(View.java:5865) at android.view.ViewGroup.(ViewGroup.java:723) at android.widget.LinearLayout.(LinearLayout.java:254) at android.widget.LinearLayout.(LinearLayout.java:250) at android.widget.LinearLayout.(LinearLayout.java:246) E/CrashReport: at com.xuexiang.xui.widget.alpha.XUIAlphaLinearLayout.(XUIAlphaLinearLayout.java:22) at com.xuexiang.xui.widget.dialog.bottomsheet.BottomSheetItemView.(BottomSheetItemView.java:32) ... 25 more 设备信息:红米K70 ;系统 Hyper os1.0.19 ;android 14

SuperReally commented 2 months ago

是我自己的问题,没有设置主题为XUITheme.Phone