Android 隐藏操作栏只显示选项卡
Android hide Actionbar show only the tabs
我想在顶部显示选项卡,隐藏操作栏。
Only the parts in the red rectangle, and hide the empty row above them.
我使用这些行来隐藏图标和操作栏上的标题:
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setDisplayShowHomeEnabled(false);
有什么建议可以让我的应用中只有标签页吗?
如果你想在代码中隐藏它。您可能还需要删除正在使用的 onCreateOptionsMenu(例如)。
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
同时在创建时添加以下行。
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setDisplayShowHomeEnabled(false);
getSupportActionBar().hide();
在您的清单中:
android:theme="@style/Theme.AppCompat.NoActionBar"
我想在顶部显示选项卡,隐藏操作栏。
Only the parts in the red rectangle, and hide the empty row above them.
我使用这些行来隐藏图标和操作栏上的标题:
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setDisplayShowHomeEnabled(false);
有什么建议可以让我的应用中只有标签页吗?
如果你想在代码中隐藏它。您可能还需要删除正在使用的 onCreateOptionsMenu(例如)。
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
同时在创建时添加以下行。
getSupportActionBar().setDisplayShowTitleEnabled(false);
getSupportActionBar().setDisplayShowHomeEnabled(false);
getSupportActionBar().hide();
在您的清单中:
android:theme="@style/Theme.AppCompat.NoActionBar"