Question

My android app is working fine with old nexus 7. But I have one issue with new nexus 7 devices. All the dynamic rendering (Image size and Text size) spoil the design like

tv1.setTextSize(getResources().getDimension(R.dimen.legend_text));

here I mentioned 4 folder named as :-

values-large-hdpi
values-large-xhdpi
values-xlarge-hdpi
values-xlarge-mdpi

and in all above folder dimen.legend_text have value 11sp. but when i trace out the value of getResources().getDimension(R.dimen.legend_text) it gives me 18.

here is my log :- 11-18 12:09:29.758: D/size of text foe nexus 7(4794): size of text foe nexus 7 is 18.0

any one have any idea which resource folder is fit for new nexus 7 (1920*1200 resolution).

Was it helpful?

Solution

Actually you're using 9sp means (px = sp*(dpi/160)) so with this formula px = 9*(320/160) means 18.
This is the reason you're getting the value 18.
In place of 9sp or 11sp keep it 9px and your problem will solve for now.
Regarding folder issue: Use large-xhdpi or sw600dp-xhdpi.

OTHER TIPS

tvdpi is the correct folder for nexus 7

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top