【问题标题】:Android - Make Navigation Bar disappearAndroid - 使导航栏消失
【发布时间】:2015-12-10 11:50:47
【问题描述】:

我已经搜索了一段时间,但我找不到让导航栏在 android 应用程序中消失的方法。这是我来自 android studio 的资源

<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <!-- Customize your theme here. -->
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
</style>
<style name="AppTheme.NoActionBar" >
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>
<style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
<style name="AppTheme.CustomPop">
    <item name="android:windowIsTranslucent">true</item>
    <item name="android:windowCloseOnTouchOutside">true</item>
</style>

和清单

<?xml version="1.0" encoding="utf-8"?>

<permission
    android:name="com.example.....maps.permission.MAPS_RECEIVE"
    android:protectionLevel="signature" />


<application

    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:supportsRtl="true"
    android:theme="@style/AppTheme.NoActionBar"
    android:label="@string/app_name"
    >

    <activity
        android:name=".Class"
        android:theme="@style/AppTheme.CustomPop" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

</application>

我在这里得到了什么

我希望带有地图字符串的栏消失。

谢谢!

【问题讨论】:

    标签: android android-manifest android-theme android-styles


    【解决方案1】:

    您可以使用标志隐藏或显示通知栏

    隐藏:

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    

    显示:

    getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    

    现在是 actionBar :

    隐藏:

    getSupportActionBar().hide();
    

    显示:

    getSupportActionBar().show();
    

    【讨论】:

    • 是的!就这样吧。其他答案粉碎了我的申请。谢谢苏安!
    【解决方案2】:

    放置这一行

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    

    紧接着

    super.onCreate(savedInstanceState);
    

    在您的 Activity onCreate 方法中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-28
      • 1970-01-01
      • 2018-10-23
      • 1970-01-01
      • 1970-01-01
      • 2020-10-19
      相关资源
      最近更新 更多