我正在面对android.view.InflateException
在我的应用程序中用于某些特定设备,在其他手机中它工作正常。但我不知道为什么。许多人说这个问题发生在可绘制的矢量图像上。我在android:background= ""
行中使用矢量图像。是这样做的InflateException
。是否有权通过在android:background中使用Vector drawable来制作android.view.InflateException?ImageView中的line:
<RelativeLayout
android:id="@+id/nameLayoutMain"
android:layout_width="wrap_content"
android:layout_height="120dp"
android:background="@drawable/shadow_164949">
<ImageView
android:layout_width="80dp"
android:layout_height="400dp"
android:background="@drawable/draw_phone"
android:id="@+id/im1"
android:layout_alignParentTop="true" />
<ImageView
android:layout_width="80dp"
android:layout_height="50dp"
app:srcCompat="@drawable/ic_phone"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toLeftOf="@+id/linearLayoutName"
android:layout_toStartOf="@+id/linearLayoutName" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/linearLayoutName"
android:gravity="center_vertical"
android:layout_alignBottom="@+id/im1"
android:layout_toRightOf="@+id/im1"
android:layout_toEndOf="@+id/im1">
<TextView
android:id="@+id/txtPhoneShow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/my_phone_number"
android:textSize="18sp"
android:layout_alignParentTop="true"
android:layout_alignLeft="@+id/txtPhone"
android:layout_alignStart="@+id/txtPhone" />
<TextView
android:id="@+id/txtPhone"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="01612548792"
android:textColor="@color/toolbar1"
android:textSize="20sp"
android:textStyle="bold"
android:layout_below="@+id/txtPhoneShow"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp" />
</RelativeLayout>
</RelativeLayout>
你能告诉我可绘制矢量的xml代码吗? –
分享错误logcat .. – Omi
你能否请检查一下。它包含我的可绘制矢量图像,我的XML,我的错误和我的Java代码。 https://drive.google.com/open?id=0B7XpFVYwQlMYcHc3Q2lHWWU3cUE –