
Android开发:隐藏和显示底部导航栏
描述:视频播放器实现全屏和小屏互相切换时,显示和隐藏底部导航栏的方法
该例子设置的Activity是去除状态栏和标题栏,全屏显示布局和电量等信。Manifest文件 theme如下:
<activity android:name=".ui.activity.UnReadListActivity" android:configChanges="orientation|keyboardHidden|screenSize" android:hardwareAccelerated="true" android:launchMode="singleTop" android:screenOrientation="portrait" android:theme="@style/AppTheme_Translucent" android:windowSoftInputMode="adjustResize" /> <style name="AppTheme_Translucent" parent="Theme.AppCompat.Light.NoActionBar"> <item name="android:windowTranslucentStatus">true</item> </style>显示和隐藏底部导航栏的方法:
/** * 控制底部导航栏,显示/隐藏虚拟按键 * * @param isShow true:显示;false:隐藏 */ private void controlBottomNavigation(boolean isShow) { //隐藏虚拟按键 if (isShow) { getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); } else { getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE); } }
👁️ 阅读量:0
© 版权声明:本文《Android开发:隐藏和显示底部导航栏》内容均为本站精心整理或网友自愿分享,如需转载请注明原文出处:https://www.zastudy.cn/wen/1686995494a415201.html。