亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在某些設備中出現錯誤“android.view.InflateException:

在某些設備中出現錯誤“android.view.InflateException:

哆啦的時光機 2023-05-24 16:26:54
我有一個Issue: android.view.InflateException: Binary XML file line #2: Binary XML file line #2: Error inflating class <unknown>在某些設備上。它在 Adapter 中膨脹時發生RecyclerView(從日志中發現)。崩潰發生在以下設備中?;钪鴙52017年K3摩托 G4 玩OPPO F4編輯 -所有崩潰的設備都有 android 6以下設備不會發生崩潰。一加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貢獻1963條經驗 獲得超6個贊

嘗試這個 :

在 drawable 中使用 png 文件,而不是在 drwable-24 中,而是在 xxhdpi 中粘貼一件事,然后在所有設備中進行測試。當然,它適用于所有設備。如果它不是僅圖像形狀的東西,請在您的問題中分享該 xml。

快樂編碼:)


查看完整回答
反對 回復 2023-05-24
?
翻翻過去那場雪

TA貢獻2065條經驗 獲得超14個贊

android:background="@drawable/rounded_corner_card_primary"

可能這就是問題所在。如果這是一個 SVG 文件,并且您在該文件中使用Offset屬性,它會在 marshmallow 中崩潰。所以最好為棉花糖設備制作一個單獨的文件并使用 png 文件。

查看完整回答
反對 回復 2023-05-24
  • 2 回答
  • 0 關注
  • 203 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號