1

我正在尝试Status bar使用PrimaryDarkColorAnd PrimaryColorlike Lollipop on Kitkat 来实现这一点,这是我的尝试:

<style name="PopularTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    <item name="colorPrimaryDark">@color/colorPrimaryDarkPopular</item>
    <item name="colorPrimary">@color/ColorPrimaryPopular</item>

    <!--here is what I've added to try to get transparency -->
    <item name="android:statusBarColor">@android:color/transparent</item>
    <item name="android:windowActionBarOverlay">true</item>
    <item name="android:windowContentTransitions">true</item>
    <item name="android:windowTranslucentNavigation">true</item>
    <item name="android:windowTranslucentStatus">true</item>
</style>

此外,我使用https://github.com/jgilfelt/SystemBarTint测试此方法,但这不是我的选择,因为我为每个活动使用另一种颜色。

如何使用KitkatPrimaryDarkColorPrimaryColor在 Kitkat 中实现该状态栏?

结果:

在此处输入图像描述

4

3 回答 3

0

我刚刚在这里查看了我工作的应用程序。

首先从下面删除所有内容<!--here is what I've added to try to get transparency -->,我们的风格中没有任何内容。然而,它适用于 AppCompat 主题或活动已经为您做的事情。

然后为 Kitkat 添加额外规则:

@TargetApi(Build.VERSION_CODES.KITKAT)
private static void setupWindowKiKat(Window window) {
   window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
}

并从您的活动中调用它:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT &&
    Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP)
     setupWindowKiKat(getWindow());

您可以将其添加到 avalues-v19\style.xml但上面是它在我们的应用程序上的方式。希望能帮助到你。

于 2015-08-30T19:00:43.893 回答
0

您应该首先根您的设备,然后去 Google Play 商店安装(Wanam Xposed)http://repo.xposed.info/module/ma.wanam.xposed 打开它并按照一些步骤然后安装(Xposed 安装程序)http://repo.xposed.info/module/de.robv.android.xposed.installer 然后打开这个最后去“下载”并寻找“平面样式彩色条”下载并安装它然后回到模块激活它并重新启动手机,您将看到更改。我希望我有所帮助。我在 ace 4 Sm-g316hu 上非常适合我

于 2016-01-17T21:33:43.173 回答
-1

这是不可能的,因为它们都在不同的 API 上运行(棒棒糖在 20、21 或 22 上)。

于 2015-08-30T18:10:18.507 回答