报错:PID: 6851  android.view.InflateException: Binary XML file line #0: Error inflating class ImageView



解决:

1、最外层布局添加: xmlns:app="http://schemas.android.com/apk/res-auto"


2、使用app:srcCompat 接收Vector

    <ImageView
        app:srcCompat="@drawable/ic_navigate_next_black_24dp"
        android:layout_gravity="center"
        android:layout_marginRight="8dp"
        android:layout_width="24dp"
        android:layout_height="24dp" />


3、添加 vectorDrawables.useSupportLibrary = true

defaultConfig {
        。。。
        vectorDrawables.useSupportLibrary = true
    }





参考:https://chris.banes.me/2016/02/25/appcompat-vector/#enabling-the-flag





相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-09
猜你喜欢
  • 2021-11-11
  • 2021-08-04
  • 2021-10-19
  • 2022-12-23
  • 2022-12-23
  • 2021-04-23
相关资源
相似解决方案