1. What should I do if I only want textview to display a row, but the text exceeds the length of textview?
- Show ellipsis at the beginning
Android: singleline = "true" Android: ellipsize = "start"
Android: singleline = "true" Android: ellipsize = "end"
- Show ellipsis in the middle
Android: singleline = "true" Android: ellipsize = "Middle"
- Automatic horizontal scrolling (running horse light effect)
Android: singleline = "true" Android: ellipsize = "marquee" Android: marqueerepeatlimit = "marquee_forever" Android: focusable = "true" Android: focusableintouchmode = "true"
Android: singleline = "true" must be added to all the above four effects, because textview will automatically wrap by default.
Android: ellipsize indicates how to display long text
Android: marqueerepeatlimit = "marquee_forever" indicates that the settings are always repeated. You can also set specific numbers.
Android: focusable = "true" and Android: focusableintouchmode = "true" must be added. Otherwise, the rolling effect will fail.
2. How can I make textview scroll vertically?
In JavaCodeAdd the following sentence to implement vertical scrolling.
Textview. setmovementmethod (scrollingmovementmethod. getinstance ());