I am trying to change the font of android.support.v7.app.AlertDialog
title text.
METHOD 1 :
TextView title = (TextView) dialog.findViewById(android.R.id.title); //returns null
METHOD 2 :
final int titleId = context.getResources().getIdentifier("alertTitle", "id", "android");
TextView title = (TextView) dialog.findViewById(titleId); //Also returns null.
Is there any other way to get the title TextView
?
Please note I do not want to use a custom layout.
Thanks.
I got it to work using this solution :
CustomTFSpan
Your question has already answer here : Change Title Font Of Alert Dialog Box Android
You can simply use a textview and set it as custom title like this :
builder.setCustomTitle(tv2);
Create a simple TextView
And replace
with
Use this one
Without any custom title :)