app:showAsAction vs android:showAsAction

后端 未结 1 758
-上瘾入骨i
-上瘾入骨i 2020-12-15 20:26

I am building an Android app and want to have a button always visible on the actionBar. I followed this guide and others, but none of them seem to solve my problem (although

相关标签:
1条回答
  • 2020-12-15 21:03

    This is the documentation of the lint rule:

    AppCompatResource

    Summary: Menu namespace

    Priority: 5 / 10

    Severity: Error

    Category: Usability

    When using the appcompat library, menu resources should refer to the showAsAction in the app: namespace, not the android: namespace.

    Similarly, when not using the appcompat library, you should be using the android:showAsAction attribute.

    I think the problem is that you are mixing Framework Activity and AppCompat menu.

    You should use AppCompatActivity with AppCompat Action bar and app:showAsAction; or Activity with android:showAsAction.

    0 讨论(0)
提交回复
热议问题