I'm using BottomSheetDialogFragment
and I'm rounding the corners of top right/left and it's working properly but I noticed that behind the rounded corners, it's not transparent and it's very annoying.
It's noticeable in the below screenshot:
How do I make them transparent?
Create custom style like below.
<style name="AppBottomSheetDialogTheme" parent="Theme.Design.Light.BottomSheetDialog">
<item name="bottomSheetStyle">@style/AppModalStyle</item>
</style>
<style name="AppModalStyle" parent="Widget.Design.BottomSheet.Modal">
<item name="android:background">@drawable/rounded_corner_top_only</item>
</style>
then override this method in the custom fragment.
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//bottom sheet round corners can be obtained but the while background appears to remove that we need to add this.
setStyle(DialogFragment.STYLE_NO_FRAME,R.style.AppBottomSheetDialogTheme);
}
This is working with me hopefully it will work with you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With