android - 带有半透明状态栏的叠加操作栏

标签 android android-actionbar android-4.4-kitkat

我正在尝试实现此处显示的效果:http://www.youtube.com/watch?v=6QHkv-bSlds&t=15m48s尼克和男孩们。我可以覆盖操作栏,但不知道如何将其扩展到状态栏。我还想知道他们如何管理导航栏后面的透明黑色背景(但这并不重要)。

任何帮助/建议将不胜感激,因为我目前不知道这是如何完成的(并且我开始担心它可能只是一个图像而不是实际的实现)。

编辑:我知道如何使条形图完全透明(那是最简单的部分)!我不知道如何扩展操作栏背景以显示在现在半透明的状态栏后面

最佳答案

我有同样的问题并找到了这个图书馆:https://github.com/jgilfelt/SystemBarTint

查看第 300 行: https://github.com/jgilfelt/SystemBarTint/blob/master/library/src/com/readystatesoftware/systembartint/SystemBarTintManager.java

setupStatusBarView() 将 View 添加到窗口的装饰中。这允许您稍后为此 View 设置颜色/可绘制对象。

如果使用 SystemBarTint 库,以下将允许您强制状态栏为指定的颜色,然后您可以将其与操作栏的背景相匹配:

SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintColor(Color.parseColor("#DD000000"));

在这种情况下,您可以将操作栏的背景设置为:#DD000000

关于android - 带有半透明状态栏的叠加操作栏,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19799097/

相关文章:

android - Toasts 在 4.4.2 中停止工作

android - Android Lollipop 上的 android-ffmpeg 问题

android - SQLite 表 android 的总和

android - 发送有序广播时,FLAG_RECEIVER_FOREGROUND 到底做了什么?

android - 无法在 android studio 中加载 AppCompat ActionBar,出现未知错误

android - 旋转时复制 ActionBar 按钮

android - Kotlin 中的通用类类型用法

android - 警报对话框不工作

Android 使用 CustomLayout 设置 ActionBar 字体

android - 可靠获取状态栏高度解决KitKat半透明导航问题