【问题标题】:Layout xml tools:targetApi not working布局 xml 工具:targetApi 不起作用
【发布时间】:2017-12-09 14:17:57
【问题描述】:

我在我的应用程序中使用https://github.com/mattprecious/swirl/blob/master/README.md。 我不想在lowwer sdk marshmallow 版本上出现SwirlView。因为 SwirlView 在版本 sdk marshmallow 或更高版本上工作。

所以我将“tools:targetApi='M'”添加到 SwirlView xml 节点。看看下面的代码。

<com.mattprecious.swirl.SwirlView
    android:id="@+id/fingerprint_SwirlView"
    android:layout_width="100dp"
    android:layout_height="100dp"
    tools:targetApi="M"/> 

但是当我在棒棒糖版本上运行应用程序时。发生这样的错误。

android.view.InflateException: Binary XML file line #29: Error inflating class com.mattprecious.swirl.SwirlView

我的代码有什么问题。 对不起我的英语水平不好。

【问题讨论】:

    标签: android xml layout


    【解决方案1】:

    您必须覆盖 xml 而不是抑制错误。工具不会影响应用,只会影响 Android Studio。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-03-04
      • 2016-12-26
      • 1970-01-01
      • 1970-01-01
      • 2015-08-14
      • 1970-01-01
      相关资源
      最近更新 更多