【问题标题】:BottomSheetDialog - remove transparent space belowBottomSheetDialog - 删除下面的透明空间
【发布时间】:2020-10-15 00:38:02
【问题描述】:

我在Android中有BottomSheetDialog,但底部(覆盖导航栏)是透明的,有什么办法可以让它变白吗?

我已将活动的 NavigationBar 颜色设置为白色,这似乎触发了透明区域:

<item name="android:navigationBarColor">@color/white</item>

我认为这并不重要,但我已将 BottomSheetDialog 的样式设置为 RoundedBottomSheetDialog 以创建圆角:

<style name="RoundedBottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog">
    <item name="bottomSheetStyle">@style/bottomSheetStyleWrapper</item>
</style>

<style name="bottomSheetStyleWrapper" parent="Widget.Design.BottomSheet.Modal">
    <item name="android:background">@android:color/transparent</item>
</style>

【问题讨论】:

    标签: android


    【解决方案1】:

    尝试在RoundedBottomSheetDialog 中添加这一行:

    <item name="android:windowIsFloating">false</item>
    

    请参阅此处了解正确实现此功能的项目:

    https://github.com/gavingt/SunCalculator/blob/master/app/src/main/res/values-v27/styles.xml

    在此处查看我在创建上述项目时使用的参考:

    https://medium.com/halcyon-mobile/implementing-googles-refreshed-modal-bottom-sheet-4e76cb5de65b

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-02
      • 2014-04-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多