如何修复 Tab Activity 操作栏在 Android 中的颜色?
How to fix Tab Activity action bar up color in Android?
操作栏上方显示白色。我想修理那个。请检查
附加图像文件。
提前致谢Image Here
试试这个:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.parseColor("#39bf96"));
}
但是,如果您想隐藏那些 Action Bar
或 Status Bar
,这会有所帮助
将此行添加到您的 style
资源文件中。
<style name="AppFullScreenTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
然后确保更改 AndroidManifest
文件中的 theme
。
例子
<activity android:name=".MainActivity"
android:label="@string/mainPageName" //Your Activity Name
android:theme="@style/AppTheme.NoActionBar"> //Change HERE
</activity>
操作栏上方显示白色。我想修理那个。请检查 附加图像文件。
提前致谢Image Here
试试这个:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(Color.parseColor("#39bf96"));
}
但是,如果您想隐藏那些 Action Bar
或 Status Bar
,这会有所帮助
将此行添加到您的 style
资源文件中。
<style name="AppFullScreenTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
然后确保更改 AndroidManifest
文件中的 theme
。
例子
<activity android:name=".MainActivity"
android:label="@string/mainPageName" //Your Activity Name
android:theme="@style/AppTheme.NoActionBar"> //Change HERE
</activity>