【问题标题】:How to add a gradient in the navigationBar of the device in Android?如何在Android设备的navigationBar中添加渐变?
【发布时间】:2020-11-14 08:13:06
【问题描述】:

我有一个 Flutter 应用,我正在尝试在应用的 NaviagtionBottomBar 中添加渐变。
我设法添加了一种单一的颜色,但我不明白如何添加渐变。

这是我的代码,这是输出

styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
        <item name="android:windowBackground">@drawable/launch_background</item>
        <item name="android:windowFullscreen">true</item>
    </style>
    <style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name="android:navigationBarColor">@color/blue</item>
    <item name="android:windowLightNavigationBar">true</item>
    </style>
</resources>

colors.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="blue">#87ceeb</color>
</resources>

输出:

【问题讨论】:

标签: android xml flutter dart


【解决方案1】:

在您的 dart 代码中,您可以用 Container 包装 BottomNavigationBar 小部件,并将 BoxDecoration 设置为 Container 的装饰属性。然后为BoxDecoration设置渐变。

【讨论】:

  • 所以这不是底部导航栏。它是设备的导航栏。
  • 对不起。现在我明白你的意思了
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-11-06
  • 2019-03-08
  • 2020-04-19
  • 1970-01-01
  • 1970-01-01
  • 2022-06-11
相关资源
最近更新 更多