Android. Font size too large to fit in cache -
i want adjust app font size device size. have values, values-hdpi, values-ldpi.. folders , added there dimens.xml file , set dimens <dimen name="task_check_box_font">16sp</dimen>
.
font size large fit in cache error.
how solve it? thanks
try this!
create screenwidth.java
public class screenwidth { public screenwidth(){} @suppresslint("newapi") public int getscreenwidth(context context) { int columnwidth ; windowmanager wm = (windowmanager) context .getsystemservice(context.window_service); display display = wm.getdefaultdisplay(); final point point = new point(); try { display.getsize(point); } catch (java.lang.nosuchmethoderror ignore) { // older device point.x = display.getwidth(); point.y = display.getheight(); } columnwidth = point.x; return columnwidth; } }
now create object of above class screen size pragmatically.
screenwidth sw = new screenwidth(); int width_sc =sw.getscreenwidth(this); textview t1 = (textview)findviewbyid(r.id.t1); t1.settextsize(((width_sc*22)/768));
hope may you!
Comments
Post a Comment