【问题标题】:Hide action bar for small screen隐藏小屏幕的操作栏
【发布时间】:2015-03-21 01:56:30
【问题描述】:

我正在开发一个 android aap,我想隐藏小屏幕 (240x320) 的操作栏,而不是普通和大屏幕。如果是那怎么隐藏呢?

【问题讨论】:

  • 使用getActionBar().hide()。

标签: android layout android-actionbar


【解决方案1】:

那么你需要先得到尺寸..

获取维度的方法如下:

Display display = getWindowManager().getDefaultDisplay(); 
int width = display.getWidth();
int height = display.getHeight();

see answers here on how to get the screen dimension

这里是隐藏操作栏的方法

    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    getActionBar().hide();

v7新增支持actionbar用户,代码为:

getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
getSupportActionBar().hide();

see answers here on how to hide action bar

【讨论】:

  • 这个逻辑很完美
【解决方案2】:

在 Android 4.0 及更低版本上隐藏状态栏

<application
...
android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" >
...

或者 必须在设置布局之前。

requestWindowFeature(Window.FEATURE_NO_TITLE);

欲了解更多信息,您可以访问Here。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-08-18
    • 1970-01-01
    • 2014-07-19
    • 2014-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多