【问题标题】:How to configure the system bar and navigation bar for immersive experience如何配置系统栏和导航栏以获得沉浸式体验
【发布时间】:2021-10-14 08:43:29
【问题描述】:

我需要像 Google 的 Google Pay App 一样配置系统栏和导航栏。

PSB 截图:
我用绿色标记了这些条。
当我们打开 google pay 应用时,这些栏的颜色变为白色,感觉就像是应用的一部分。

我们还可以滚动出文本/图像并将它们显示在系统栏中。
体验是身临其境的。
我的应用需要相同的设计(即透明/无色系统和导航栏)

如何在不触及任何基本功能的情况下以适当的方式实现这一点?
我读了这篇文章:Enable fullscreen mode
而且我还阅读了很多关于这个领域的答案,但找不到解决方案。

请告知如何像 google pay 应用一样实现它?
滚动时如何在系统栏中显示我的文本?

【问题讨论】:

    标签: android kotlin android-layout material-design android-theme


    【解决方案1】:

    这需要最低 API 23(也许我错了)答案像往常一样在文档中 https://developer.android.com/training/gestures/edge-to-edge#change-color

    简单地说:你应该编辑themes.xml

    <!-- values-v29/themes.xml -->
    <style name="Theme.MyApp">
      <item name="android:navigationBarColor">
         @android:color/transparent
      </item>
    
      <!-- Optional: set to transparent if your app is drawing behind the status bar. -->
      <item name="android:statusBarColor">
         @android:color/transparent
      </item>
    
      <!-- Optional: set the status bar light and content dark. -->
      <item name="android:windowLightStatusBar">
        true
      </item>
    </style>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-11
      相关资源
      最近更新 更多