美文网首页
记Android-BottomSheetDialogFragme

记Android-BottomSheetDialogFragme

作者: 晖仔Milo | 来源:发表于2021-08-16 17:11 被阅读0次

今天开发,ui给了一张这样的图


image.png

好家伙,分析一番,自然是用BottomSheetDialogFragment实现最为妥当。但是,在实现圆角的时候怎么都不能符合预期,最终,循着源码发现如下。


image.png

好吧,连注解都没有,总之用它就对了。
修改:
1、代码中重写

    @Override
    public int getTheme() {
        return R.style.TranslucentHalfBottomSheetFragment;
    }

2、粘贴一下我的style

    <style name="TranslucentHalfBottomSheetFragment">
        <item name="android:windowBackground">@color/transparent_half</item>
        <item name="android:colorBackgroundCacheHint">@null</item>
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowCloseOnTouchOutside">true</item>
        <!-- Note that we use the base animation style here (that is no
             animations) because we really have no idea how this kind of
             activity will be used. -->
        <item name="android:windowAnimationStyle">@android:style/Animation</item>
    </style>

这样,就妥啦。

相关文章

网友评论

      本文标题:记Android-BottomSheetDialogFragme

      本文链接:https://www.haomeiwen.com/subject/ymxvbltx.html