-1

I want to know why View is not working for notification layout.

InflateException: Binary XML file line #8: Error inflating class ImageView

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <ImageView
        android:id="@+id/imagenotileft"
        android:layout_width="@dimen/_10sdp"
        android:layout_height="@dimen/_10sdp"
        android:layout_margin="@dimen/_5sdp"
        android:layout_marginBottom="@dimen/_5sdp"
        android:gravity="center"
        android:src="@drawable/app_icon" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:gravity="center"
        android:text="Bytepaper"
        android:textColor="@color/colorPrimary" />

    <View
        android:layout_width="@dimen/_1sdp"
        android:layout_height="match_parent"
        android:layout_margin="@dimen/_5sdp"
        android:background="@color/greyTextColor" />

    <TextView
        android:id="@+id/textNotifMail"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:gravity="center"
        android:text="Bytepaper"
        android:textColor="@color/greyTextColor" />

    <View
        android:layout_width="@dimen/_1sdp"
        android:layout_height="match_parent"
        android:layout_margin="@dimen/_5sdp"
        android:background="@color/greyTextColor" />

    <TextView
        android:id="@+id/textNotifTime"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:gravity="center"
        android:text="Bytepaper"
        android:textColor="@color/greyTextColor" />
</LinearLayout>

Please see I have used <View/> tag.

Mr Lister
  • 45,515
  • 15
  • 108
  • 150
D. Rathore
  • 27
  • 6

1 Answers1

1

Change image view code to below code

<ImageView
        android:id="@+id/imagenotileft"
        android:layout_width="@dimen/_10sdp"
        android:layout_height="@dimen/_10sdp"
        android:layout_margin="@dimen/_5sdp"
        android:layout_marginBottom="@dimen/_5sdp"
        android:gravity="center"
        app:srcCompat="@drawable/app_icon" />