1

I am attempting to create a textView that will take up a large portion of the top center part of the screen. Ideally, setting the text size in dp would allow the textView to remain the correct relative size (taking up about 70% of the width of the screen, and maybe 20% of the top). It looks correct in the layout editor, and in the emulator at HVGA resolution. However, when I test it at higher resolutions (on my tablet, or emulating a 720p display) the text takes up a very small portion of the top center part of the screen. (maybe 30% width instead of 70%, and it doesn't seem any larger vertically).

Is there a way to scale text to correctly increase relative size with resolution?

Nyth
  • 582
  • 5
  • 16

2 Answers2

0

Set the layout_width as fill_parent, which will make it spread across the screen for all devices. Add some padding on left right and top which seems suitable. The padding might seem different for different screens but still this might be a better solution.

Alabhya
  • 490
  • 1
  • 9
  • 16
0

set android:layout_width="match_parent" edit: check this out Auto Scale TextView Text to Fit within Bounds

Community
  • 1
  • 1
user1324936
  • 2,187
  • 4
  • 36
  • 49
  • I am having the textView and it's parent view's width set to fill_parent and that seems to be working fine. the problem is that the text isn't increasing in size with the size of the screen. – Nyth May 28 '12 at 05:27
  • dp is a density independent pixel, your text will have the same size on a hd unit display but not on a wider display. I found your problem has no simple soulution, i edited my answer – user1324936 May 28 '12 at 10:35