在 Activity 中删除操作栏的正确方法是什么?
我的 Activity 扩展了 org.holoeverywhere.app.Activity
我有一个扩展 org.holoeverywhere.app.Application 的自定义应用程序类,并在启动时执行此静态代码:
ThemeManager.setDefaultTheme(ThemeManager.DARK);
ThemeManager.map(ThemeManager.DARK, R.style.Holo_Demo_Theme);
ThemeManager.map(ThemeManager.LIGHT, R.style.Holo_Demo_Theme_Light);
ThemeManager.map(ThemeManager.MIXED, R.style.Holo_Demo_Theme_Light_DarkActionBar);
ThemeManager.map(ThemeManager.DARK | ThemeManager.FULLSCREEN, R.style.Holo_Demo_Theme_Fullscreen);
ThemeManager.map(ThemeManager.LIGHT | ThemeManager.FULLSCREEN, R.style.Holo_Demo_Theme_Light_Fullscreen);
ThemeManager.map(ThemeManager.MIXED | ThemeManager.FULLSCREEN, R.style.Holo_Demo_Theme_Light_DarkActionBar_Fullscreen);
在我的 Activity 中:
protected void onCreate(Bundle savedInstanceState) {
ThemeManager.removeTheme(this);
setTheme(ThemeManager.DARK | ThemeManager.FULLSCREEN);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
如果我在代码中添加 requestWindowFeature(Window.FEATURE_NO_TITLE)
,则在 android 4.1.1
-table- 上删除栏
在手机上 -android 2.3.3
- 栏没有被移除。
在引入 holoeverywhere 之前,只需使用 requestWindowFeature(Window.FEATURE_NO_TITLE) 就可以正常工作。
在运行时删除 holoeverywhere 中的操作栏的正确方法是什么? (我想在运行时这样做,因为用户可以选择设置 DARK 或 LIGHT 布局,默认为 DARK)
最佳答案
参见标志 ThemeManager.NO_ACTION_BAR。 或者直接打电话
getSupportActionBar().hide();
关于android - Holoeverywhere : how to programmatically remove at runtime the action bar from an activity,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16343979/