• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Adjust font size

Hi All,

How can I prevent Font size changes from affecting the controls on my app?
I have tried the following
public void adjustFontScale(Configuration configuration)
{
if(configuration.fontScale > 1.3f) {
configuration.fontScale = 1.3f;
DisplayMetrics metrics = getResources().getDisplayMetrics();
WindowManager wm = (WindowManager) getSystemService(WINDOW_SERVICE);
wm.getDefaultDisplay().getMetrics(metrics);
metrics.scaledDensity = configuration.fontScale * metrics.density;
getBaseContext().getResources().updateConfiguration(configuration, metrics);
}
}
I am able to override font size of the activity using above code. But I want just the header layout(containing button and textView) size to be controlled, not the entire activity. How do I achieve that?
 
Back
Top Bottom