Android的主题,全屏和操作栏 [英] Android theme, fullscreen and the action bar

查看:110
本文介绍了Android的主题,全屏和操作栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我也有一些问题,有操作栏中的设备。在手机上运行时,我想去全屏,没有标题栏,无状态栏。在片我想说明的操作栏,但仍然没有标题栏。 Minsdk是7!当你切换到全屏模式的方法setTheme不工作,所以我不能有两个主题。有没有一种方法,以显示在全屏模式下的操作栏?支持库不支持行动吧。

我想这样做摆在首位的唯一原因是因为他们没有很好的理由通过移动菜单键的操作栏都打破了落后compability。最简单的解决方案,这根据文档是添加机器人:showAsAction =ifRoom菜单项。但是,这是绝对没有。

我还测试了多种解决方案,我发现在谷歌,理应切换全屏。他们没有对我的任何设备的工作,所以请不要点东西,你读过如果你还没有使用它自己。

编辑:我解决了这一点。这个问题似乎是,你必须指定一个河洛主题,以获得操作栏后面。否则它不会显示。我在我的主要活动补充这一点。

  @覆盖
公共无效setTheme(INT渣油){
    如果(isTablet(本))
    {
        super.setTheme(android.R.style.Theme_Holo);
        返回;
    }
    super.setTheme(渣油);
}
 

解决方案
  

在片我要显示操作栏,但仍然没有标题栏

操作栏取代了标题栏。有一个活动有一个操作栏没有概念的的标题栏。

  

有没有一种方法,以显示在全屏模式下的操作栏?

AFAIK,没有按照定义。

  

支持库不支持行动吧。

ActionBarSherlock提供API 7级及以上的操作栏的反向移植。

  

这个根据文档的简单的解决方法是添加机器人:showAsAction =ifRoom菜单项。但是,这是绝对没有。

这当然什么都不做,如果你没有行动起来吧。如果你想有一个全屏体验,那么你将需要推出自己的菜单更换。恕我直言,最全屏应用程序这样做已经(例如,利用游戏风格的菜单一个游戏罢了)。

I have have some problems with devices that have the action bar. When running on a phone I want to go fullscreen with no title bar and no status bar. On tablets I want to show the action bar but still no title bar. Minsdk is 7! The method setTheme doesn't work when you toggle fullscreen so I can't have two themes. Is there a way to show the action bar in fullscreen mode? The support library doesn't support the Action bar.

The only reason I want to do this in the first place is cause they for no good reason at all broke the backward compability by moving the menu key to the action bar. The easy solution for this according to the docs is to add android:showAsAction="ifRoom" to the menu items. But that does absolutly nothing.

I've also tested numerous solutions I found on google that supposedly toggles fullscreen. None of them work on any of my devices so please do not point to something you've read if you haven't used it yourself.

EDIT: I Solved this. The problem seems to be that you have to specify a Holo theme to get the action bar back. Otherwise it won't show. I added this in my main Activity.

@Override
public void setTheme(int resid) {
    if(isTablet(this))
    {
        super.setTheme(android.R.style.Theme_Holo);
        return;
    }
    super.setTheme(resid);
}

解决方案

On tablets I want to show the action bar but still no title bar

The action bar replaces the title bar. There is no concept of an activity having an action bar and a title bar.

Is there a way to show the action bar in fullscreen mode?

AFAIK, no, by definition.

The support library doesn't support the Action bar.

ActionBarSherlock provides a backport of the action bar for API Level 7 and higher.

The easy solution for this according to the docs is to add android:showAsAction="ifRoom" to the menu items. But that does absolutly nothing.

It certainly "does nothing" if you have no action bar. If you want a fullscreen experience, then you will need to roll your own menu replacement. IMHO, most fullscreen apps did this already (e.g., a game going with a game-styled "menu").

这篇关于Android的主题,全屏和操作栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆