第一步
在 drawable 新增 xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@android:color/white" />
<corners android:topLeftRadius="11dp" android:topRightRadius="11dp" />
</shape>
</item>
</selector>
第二部
在 themes 新增 style
<style name="AppBottomSheet" parent="Theme.Design.Light.BottomSheetDialog">
<item name="bottomSheetStyle">@style/AppBottomSheetStyle</item>
</style>
<style name="AppBottomSheetStyle" parent="Widget.Design.BottomSheet.Modal">
<item name="android:background">@drawable/bg_circle_white_pop</item>
</style>
第三步
BottomSheetDialogFragment生命周期中添加
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(STYLE_NORMAL, R.style.AppBottomSheet)
}