我想在平板电脑的操作栏上设置搜索按钮中心。我不知道怎么做?
请参阅此Image
答案 0 :(得分:0)
我认为android:showAsAction="ifRoom"
适合你。
从docs开始,您应该将showAsAction属性添加到always或ifRoom
即:
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<!-- Search, should appear as action button -->
<item android:id="@+id/action_search"
android:icon="@drawable/ic_action_search"
android:title="@string/action_search"
android:showAsAction="ifRoom" />
<!-- Settings, should always be in the overflow -->
<item android:id="@+id/action_settings"
android:title="@string/action_settings"
android:showAsAction="never" />