[英]Error in Main.xml
我收到錯誤:錯誤:在包中找不到屬性'showAsAction'的資源標識符:
我無法找出為什么我會收到這個錯誤,但我已經在這幾個小時沒有任何突破。 我搜索過谷歌有很多不同的決議,但沒有一個看起來對我有用。
如果有人能幫我指導修復錯誤,我將不勝感激。
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context="org.nibbler.zoe.liteplayer.MainActivity" >
<item
android:id="@+id/action_settings"
android:orderInCategory="100"
android:title="@string/action_settings"
app:showAsAction="never"/>
</menu>
最有可能showAsAction
不是您的屬性,因此在app:
namespace中不可用。 你的意思是android:showAsAction
?
如果你的最低版本低於14,並且你想為14個以下api設備添加showAsAction,那么你可以使用它。
1.)U need support library to be added in build path.
2.)Need to add app theme as Theme.appcompat.
3)Rest are as u are using means add ur own namespace with .../res-auto value and use that name with showAsAction
您可以像http://developer.android.com/tools/support-library/setup.html一樣添加支持lib res
您需要擴展ActionBarActivity而不是Activity。
有關完整的操作欄指南,請訪問http://developer.android.com/training/basics/actionbar/setting-up.html鏈接
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.