哆啦的時(shí)光機(jī)
2023-05-24 16:26:54
我有一個(gè)Issue: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class <unknown>在某些設(shè)備上。它在 Adapter 中膨脹時(shí)發(fā)生RecyclerView(從日志中發(fā)現(xiàn))。崩潰發(fā)生在以下設(shè)備中?;钪鴙52017年K3摩托 G4 玩OPPO F4編輯 -所有崩潰的設(shè)備都有 android 6以下設(shè)備不會(huì)發(fā)生崩潰。一加5t蓋樂世 S9Xperia XZ1 CompactAdapterAnimationPicker.java@Override? ? public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {? ? ? ? context = parent.getContext();? ? ? ? // error happening below line? ? ? ? View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_animation_picker,parent,false);? ? ? ? mFirebaseAnalytics = FirebaseAnalytics.getInstance(context);? ? ? ? return new ViewHolder(v);? ? }card_animation_picker.xml<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"? ? xmlns:app="http://schemas.android.com/apk/res-auto"? ? android:orientation="vertical"? ? android:layout_width="match_parent"? ? android:layout_height="wrap_content"? ? android:clipToPadding="false"? ? android:background="@drawable/rounded_corner_card_primary">? ? <LinearLayout? ? ? ? android:layout_height="wrap_content"? ? ? ? android:layout_width="match_parent">? ? ? ? <androidx.constraintlayout.widget.ConstraintLayout? ? ? ? ? ? android:layout_width="match_parent"? ? ? ? ? ? android:layout_height="wrap_content">? ? ? ? ? ? <FrameLayout? ? ? ? ? ? ? ? android:id="@+id/card_anim_picker_framelayout"? ? ? ? ? ? ? ? android:background="@drawable/rounded_corner_card_primary"? ? ? ? ? ? ? ? android:layout_width="0dp"? ? ? ? ? ? ? ? android:layout_height="0dp"? ? ? ? ? ? ? ? app:layout_constraintDimensionRatio="H,16:9"? ? ? ? ? ? ? ? app:layout_constraintEnd_toEndOf="parent"? ? ? ? ? ? ? ? app:layout_constraintStart_toStartOf="parent"? ? ? ? ? ? ? ? app:layout_constraintTop_toTopOf="parent">? ? ? ? ? ? ? ? <com.airbnb.lottie.LottieAnimationView? ? ? ? ? ? ? ? ? ? android:id="@+id/card_anim_picker_animation_view"? ? ? ? ? ? ? ? ? ? android:layout_width="match_parent"
2 回答

神不在的星期二
TA貢獻(xiàn)1963條經(jīng)驗(yàn) 獲得超6個(gè)贊
嘗試這個(gè) :
在 drawable 中使用 png 文件,而不是在 drwable-24 中,而是在 xxhdpi 中粘貼一件事,然后在所有設(shè)備中進(jìn)行測(cè)試。當(dāng)然,它適用于所有設(shè)備。如果它不是僅圖像形狀的東西,請(qǐng)?jiān)谀膯栴}中分享該 xml。
快樂編碼:)

翻翻過去那場(chǎng)雪
TA貢獻(xiàn)2065條經(jīng)驗(yàn) 獲得超14個(gè)贊
android:background="@drawable/rounded_corner_card_primary"
可能這就是問題所在。如果這是一個(gè) SVG 文件,并且您在該文件中使用Offset屬性,它會(huì)在 marshmallow 中崩潰。所以最好為棉花糖設(shè)備制作一個(gè)單獨(dú)的文件并使用 png 文件。
添加回答
舉報(bào)
0/150
提交
取消