I want to change the app font to roboto
. I have tried this link also.
But it is changing only the textview font, not changing the listview adapter XML font.
How do I change the entire app font to roboto
?
I want to change the app font to roboto
. I have tried this link also.
But it is changing only the textview font, not changing the listview adapter XML font.
How do I change the entire app font to roboto
?
You can pass the content view / or any view group to this function and a typeface.
public void replaceFonts(ViewGroup viewTree, TypeFace typeface) {
Stack<ViewGroup> stackOfViewGroup = new Stack<ViewGroup>();
stackOfViewGroup.push(viewTree);
while (!stackOfViewGroup.isEmpty()) {
ViewGroup tree = stackOfViewGroup.pop();
for (int i = 0; i < tree.getChildCount(); i++) {
View child = tree.getChildAt(i);
if (child instanceof ViewGroup) {
// recursive call
stackOfViewGroup.push((ViewGroup) child);
}else if (child instanceof Button) {
((Button) child).setTypeface(typeface);
}else if (child instanceof EditText) {
((EditText) child).setTypeface(typeface);
} else if (child instanceof TextView) {
// base case
((TextView) child).setTypeface(typeface);
}
}
}
}
Or create a custom Button, EditText,TextView .and add it to view group. Search for FontTextView on Google.
Put this in your style.xml
also you have to change this.
Developer site has provided information on this. Let me know the progress