我在我的应用中使用操作栏。但是当我在移动操作栏上运行应用程序时,它会分裂并显示在按钮上。但当我将应用程序运行到sumsung选项卡时,拆分不会显示给我。任何人都可以提前告诉我原因。我附加两个屏幕截图。
ActionBar actionBar = getSupportActionBar();
actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
Tab tab = actionBar.newTab();
tab.setText("abc");
tab.setIcon(R.drawable.abc_ic_go);
tab.setTabListener(new TabListener() {...}
.....
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
return super.onCreateOptionsMenu(menu);
}
<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="com.example.demoactionbar.MainActivity" >
<item
android:id="@+id/action_settings"
android:icon="@drawable/abc_ic_clear"
android:orderInCategory="0"
android:title="@string/action_settings"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/action_settings"
android:icon="@drawable/abc_ic_clear"
android:orderInCategory="1"
android:title="@string/group_item1"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/action_settings"
android:icon="@drawable/abc_ic_clear"
android:orderInCategory="2"
android:title="@string/group_item2"
app:showAsAction="ifRoom"/>
<item
android:id="@+id/action_settings"
android:icon="@drawable/abc_ic_clear"
android:orderInCategory="3"
android:title="@string/group_item2"
app:showAsAction="ifRoom"/>
</menu>