【问题标题】:How to show content below transparent status bar in Kitkat如何在 Kitkat 的透明状态栏下方显示内容
【发布时间】:2016-03-08 14:40:34
【问题描述】:

我目前正在手机中运行 Kitkat (4.4.2),并安装了一个应用程序。

在此应用中,状态栏是透明的,并在其下方显示应用的内容。 请看图片。

Image 1

Image 2

我应该如何在我的程序中做到这一点。

提前致谢。

【问题讨论】:

  • 搜索关键词为:“Android透明状态栏”。第一次点击:blog.raffaeu.com/archive/2015/04/11/… 我现在将投票结束,因为这不是 SO 的主题问题。请阅读FAQ 了解有关如何提出什么样的问题的更多详细信息。
  • 感谢 WarrenFaith,但您提到的博客中显示的状态栏显示该栏带有一些暗色。如何处理?
  • 您应该开始搜索!点击两次即可找到:stackoverflow.com/questions/21865621/… 见右下方标题为:“相关”的列表,您可以在那里找到很好的相关问题和答案!
  • 非常感谢 :) WarrenFaith

标签: android layout transparent


【解决方案1】:

正如 WarrenFaith 建议的,http://blog.raffaeu.com/archive/2015/04/11/android-and-the-transparent-status-bar.aspx 包含此问题的详细答案。

【讨论】:

    【解决方案2】:

    您可以使用此库为 kitkat 中的状态栏着色。

    https://github.com/jgilfelt/SystemBarTint

    以下是 MainActivity.java 的代码

      if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) {
            Window w = getWindow();
            w.setFlags(
                    WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,
                         WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
                 w.setFlags(
                        WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,
                       WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
                 SystemBarTintManager systemBarTintManager = new         SystemBarTintManager(this);
                systemBarTintManager.setStatusBarTintEnabled(true);
                systemBarTintManager.setStatusBarTintColor(Color.parseColor("#689F38"));
    
        }
    

    【讨论】:

      猜你喜欢
      • 2015-11-03
      • 1970-01-01
      • 1970-01-01
      • 2020-02-16
      • 2014-03-18
      • 1970-01-01
      • 2015-08-06
      • 1970-01-01
      • 2015-01-21
      相关资源
      最近更新 更多