Alex Rivera | Logout

Text size with different resolution

Asked 2012-09-27T11:28:26.267
17

i am using a galaxy tab 1, 7inch hdpi and a galaxy tab plus, 7 inch hdpi but more resolution, and in my application, the text can be read fine in galaxy tab but in galaxy tab plus there are too much small. Im using sp in font size and layout-large. Any idea? Thanks

Edit
Report

2 Answers

19

By hardware specifications Galaxy Tab 1 is MDPI device, but because it uses Android 2.x Samsung set it programmatically to use HDPI resources. So I can advice you to make following:

  1. Create file dimens.xml in values directory.
  2. Put there <dimen name="font_size">30sp</dimen>. This is default font size.
  3. Create file dimens.xml in values-large directory.
  4. Put there <dimen name="font_size">20sp</dimen>. This is font size for galaxy tab 1.
  5. Create file dimens.xml in values-sw600dp directory.
  6. Put there <dimen name="font_size">30sp</dimen>. This is font size for other tablets with Android 3.x and newer.
  7. In layout specify android:textSize="@dimens/font_size"
answered 2012-09-27T11:40:23.477
2

You can use any of this dimensions, that market as based on the physical size of screen. Than texts on all devices will have the same physical size.

answered 2012-09-27T11:35:44.603

Your Answer