Monday 15 September 2014

android - TextView ellipsize height wise -


What is the equivalent of android: ellipsize (which ellipsizes text that is too long on x -exx) which is too long on the y-axis for text? I have a textView that should be a certain height, although the text inside it is too long to fit in all and I would like to stop it before cutting it in half.

example cuts

I android: maxLines < / Code> attribute, so I can support many screen sizes.

I have also considered using it ...

  int maxLines = (int) textView.getHyight () / textView.getLineHeight (); TextView.setMaxLines (Maxlines);   

..., but there can be a problem with it because.

EDIT: I can use ScrollView to stop the cut in half of the text here, but I would rather have a preview, the user was given below to click to see the full text With buttons.

You can wrap your TextView inside a ScrollView.

  & lt; ScrollView Android: Android: Android: layout_width = "fill_parent" Android: layout_height = "100dp" Android: scrollbar = "vertical" & gt; & Lt; TextView Android: ID = "@ + ID / My Text" Android: layout_width = "fill_parent" Android: layout_height = "fill_parent" Android: text = "text" /> & Lt; / Scrollview & gt;    

No comments:

Post a Comment