MaterialComponents theme alert dialog buttons

I figured out what was causing this problem. I need to use different AlertDialog class: androidx.appcompat.app.AlertDialog When I switched to this everything started working as expected. Here’s where I found the solution: https://github.com/material-components/material-components-android/issues/162

BottomSheetBehavior not in androidX libraries

It turns out that the refactor tool in Android Studio Refactor > Migrate to AndroidX didn’t correctly migrate the XML for the BottomSheetBehaviour. The old location was android.support.design.widget.BottomSheetBehavior, and was not modified by the migration tool. The original XML was: <fragment android:id=”@+id/player_bottom_sheet_fragment” android:name=”app.rxsongbrowsertrials.ui.player.PlayerToggleFragment” android:layout_width=”match_parent” android:layout_height=”match_parent” app:behavior_hideable=”false” app:behavior_peekHeight=”56dp” app:layout_behavior=”android.support.design.widget.BottomSheetBehavior” /> The new location is com.google.android.material.bottomsheet.BottomSheetBehavior, so … Read more

Material Design not styling alert dialogs

UPDATED ON Aug 2019 WITH The Material components for android library: With the new Material components for Android library you can use the new com.google.android.material.dialog.MaterialAlertDialogBuilder class, which extends from the existing androidx.appcompat.AlertDialog.Builder class and provides support for the latest Material Design specifications. Just use something like this: new MaterialAlertDialogBuilder(context) .setTitle(“Dialog”) .setMessage(“Lorem ipsum dolor ….”) .setPositiveButton(“Ok”, … Read more

Toolbar overlapping below status bar

Use android:fitsSystemWindows=”true” in the root view of your layout (LinearLayout in your case). And android:fitsSystemWindows is an internal attribute to adjust view layout based on system windows such as the status bar. If true, adjusts the padding of this view to leave space for the system windows. Will only take effect if this view is … Read more

Round corner for BottomSheetDialogFragment

Create a custom drawable rounded_dialog.xml: <?xml version=”1.0″ encoding=”utf-8″?> <shape xmlns:android=”http://schemas.android.com/apk/res/android” android:shape=”rectangle”> <solid android:color=”@android:color/white”/> <corners android:topLeftRadius=”16dp” android:topRightRadius=”16dp”/> </shape> Then override bottomSheetDialogTheme on styles.xml using the drawable as background: <style name=”AppTheme” parent=”Theme.AppCompat.Light.NoActionBar”> <item name=”bottomSheetDialogTheme”>@style/AppBottomSheetDialogTheme</item> </style> <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_dialog</item> </style> This will change all the BottomSheetDialogs of your app.