0

In my widget layout file, I have set textview text sizes and all my content fits inside the widget. When I launched on a smaller phone (320x480) a lot of the text was cut off and was not visible on the widget. How can I account for smaller phone sizes and define smaller textview sizes?

Karim O.
  • 1,325
  • 6
  • 22
  • 36

2 Answers2

0

Refer this answer and add

android:maxWidth="size"  //size- the number more than 1

this in your textview layout

Community
  • 1
  • 1
Kiran Benny Joseph
  • 6,755
  • 4
  • 38
  • 57
0

You should use dimens to set textsize based on phone's screensize.

enter image description here

Look in above image I made 4 dimens for different screen sizes. In dimens(w820dp) I wrote following code.

<resources>
<!--include 7" and 10" devices -->
<dimen name="activity_horizontal_margin">64dp</dimen>
<dimen name="item_image_size">60dp</dimen>
</resources>

While in dimens.xml(sw600dp) I wrote following code as per requirements.

<resources>
<!-- For 7” tablets (600dp wide and bigger) -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="item_image_size">54dp</dimen>
</resources>
Sunil Parmar
  • 1,223
  • 1
  • 13
  • 22