Search code examples
androidandroid-layoutdpiscreen-size

Android - Dynamic text scaling for same dpi but different screen size


In my app I create multiple TextViews dynamically and the text size for each one I derive from the value stored in dimens.xml under values folder. On one hand I have the Nexus 4 and on the other hand I have Nexus 10. Both have the same "xhdpi" density bucket but one has the screen size of 4.7 inches and other has a screen size of 10.05 inches. I can have the same value for textsize due to their same density bucket but the text appearing fine on Nexus 4 appears too small on Nexus 10. How can I have my text appear appropriately large on such devices ? Let me know if any files need to be included.


Solution

  • After doing a lot more research I found out you can use both size and resolution specifiers together. I simply used values-xlarge-mdpi for Nexus 10 and values-large-mdpi for Nexus 4.