android - Holoeverywhere : how to programmatically remove at runtime the action bar from an activity

标签 android android-layout android-widget android-holo-everywhere

在 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/

相关文章:

android - 如何在android中为每一行设置gridlayout的背景图片?

android - 无法与 PopupWindow 和 Background (GoogleMap) 交互

android - 使用 TabHost 时如何消除像素错误

android - 如何在 Canvas 的右下角绘制小标志类型的图像?

java - Android 应用程序 - 连接到 Google Cloud SQL

java - 基本网络.performRequest : Unexpected response code 400 (GET)

android - 试图在 Android 中将按钮推到线性布局的底部

java - 如何从 ANDROID 中的 sqlite 数据库中获取数据??

android - 下载 PDF 时 InputStream 返回空文件

android - 在 Android 上绘制大量圆圈的最佳方法?