I needed rounded corners on my BottomSheetDialogFragment so I applied a custom drawable as its background. But after applying a custom background the button on the BottomSheet is not accepting a custom background. It just displays a white background. backgroundTint works fine and changes the color of the button.
themes.xml :
<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/add_new_bg</item>
</style>
add_new_bg.xml :
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid
android:color="@color/background"/>
<corners
android:topLeftRadius="40dp"
android:topRightRadius="40dp"/>
</shape>
BottomSheetDialogFragment code :
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setStyle(STYLE_NORMAL, R.style.AppBottomSheetDialogTheme);
}
Try this :
example :
and your button is :
add this in your themes.xml below main theme
example :
but your button use :
then add :
themes with button type must be same type.
let me know if this works for you.. and upvote it :)