I have a simple alert dialog to being shown in my app and I want to set custom font for title and message texts, even though I set a style by adding fontFamily attr. into it it doesnt effect on message text(title got the correct font somehow)
what I've tried so far is below:
ContextThemeWrapper
Context context = new ContextThemeWrapper(context, R.style.NetworkAlertDialogStyle);`
AlertDialog.Builder builder = new AlertDialog.Builder(context);
Style
<style name="NetworkAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog">
<item name="android:textViewStyle">@style/MyTextViewStyle</item>
</style>
<style name="MyTextViewStyle" parent="android:Widget.TextView">
<item name="android:fontFamily">@font/baloo2_bold</item>
<item name="android:textSize">18sp</item>
<item name="android:textColor">@color/black</item>
</style>
Passing style to constructor of AlertDialog builder
AlertDialog.Builder builder = new AlertDialog.Builder(context, R.style.NetworkAlertDialogStyle);
<style name="NetworkAlertDialogStyle" parent="Theme.AppCompat.Light.Dialog.Alert">
<item name="colorAccent">@color/colorPrimary</item>
<item name="android:textColor">@color/colorPrimary</item>
<item name="android:fontFamily">@font/baloo2_regular</item>
</style>