When i use dialog.builder the font size is correct but when i use MaterialAlertDialogBuilder the font size of body text is smaller. its ok?
implementation 'com.google.android.material:material:1.1.0-alpha06'
Im use this theme
<style name="AppTheme" parent="Theme.MaterialComponents.Light">
MaterialComponent code
MaterialAlertDialogBuilder(this)
.setMessage("This is a test of MaterialAlertDialogBuilder")
.setPositiveButton("Ok", null)
.show()
AlertDialog.Builder
AlertDialog.Builder(this)
.setMessage("This is a test of AlertDialog.Builder")
.setPositiveButton("Ok", null)
.show()
Where is the problem?
It is intentional. They are using different styles.
You can change it using something like:
<style name="Body_ThemeOverlay.MaterialComponents.MaterialAlertDialog" parent="@style/ThemeOverlay.MaterialComponents.MaterialAlertDialog">
<item name="materialAlertDialogBodyTextStyle">@style/BodyMaterialAlertDialog.MaterialComponents.Body.Text</item>
</style>
<style name="BodyMaterialAlertDialog.MaterialComponents.Body.Text" parent="MaterialAlertDialog.MaterialComponents.Body.Text">
<item name="android:textColor">@color/colorAccent</item>
<item name="android:textAllCaps">true</item>
<item name="android:textSize">16sp</item>
<item name="android:textStyle">bold</item>
</style>
and then:
new MaterialAlertDialogBuilder(this,
R.style.Body_ThemeOverlay_MaterialComponents_MaterialAlertDialog)
.setTitle("Title")
.setMessage("Message......")
...
.show();