android - android - 如何从状态栏中删除黑暗
问题描述
我的状态栏中有黑暗,我想将其删除。我删除了状态和工具栏颜色以用渐变颜色替换它
这些是我的代码:
<style name="AppTheme.TransparentTheme">
<item name="android:navigationBarColor">@android:color/transparent</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowDrawsSystemBarBackgrounds">false</item>
</style>
在我的代码中:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS );
结果是这样的:
解决方案
您可以将此代码用于要删除深色以及要显示的颜色的特定屏幕。将此代码放在该类中的 setContentView 之后
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = getWindow();
// clear FLAG_TRANSLUCENT_STATUS flag:
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.setStatusBarColor(getResources().getColor(R.color.Your_color));
to change the same color in the navigation bar
window.setNavigationBarColor(@ColorInt int color)
}
试试这个,让我知道。
推荐阅读
- c++ - C ++:在另一个函数中声明一个函数不是编译器错误所以......它是什么?
- swift - 如何在右侧绘制类似于所示图像的带有 ARC 的 UIBezierPath?
- c# - C# 使用预定义的排序数组对数组进行排序
- c++ - 用于 OSX/Windows 编译的 Cmakelists.txt 问题
- python - 如何迭代熊猫数据框的集合?
- python - 将文件中的多行转换为元组和列表格式
- android - Android 设备没有响应
- javascript - 递增/递减时将整数限制为数组 indeces
- docker - 如何解决这个烦人的 docker 错误?(注册图层失败)
- spring - OAuth2Authentication.getPrincipal() 返回 client_id 而不是用户名