How to get nowrap in Spannable in TextView?

644 views Asked by At

Is it possible to make only a part of the text in TextView not wrap to the next line?

Currently I have:

|Some long description [kg/|
|m^2]                      |

On small screens I want:

|Some long description     |
|[kg/m^2]                  |

But if there is enough space on the screen I want:

|Some long description [kg/m^2]         |

so that the part of the text [kg/m^2] is always in one piece.

1

There are 1 answers

0
wi1 On
  1. Create separate layouts for the different screen sizes using smallest width qualifier.
  2. Separate the description and the units in separate TextViews.
  3. For smaller screens place the TextViews in a LinearLayout with orientation set to vertical.
  4. For larger screens place the TextViews in a LinearLayout with orientation set to horizontal.

See here for more details http://developer.android.com/training/multiscreen/screensizes.html