It's been a long time today. It's actually very simple. Just add a few attributes!
The figure is as follows:
Some say that the TextView method should be rewritten, some say that the fixed length should be set, but I did not overwrite it or set the fixed length! Run on the phone 2.3.3. I don't know if this effect can be achieved elsewhere!
The Code is as follows: (the code in other places does not matter)
- <TextView
- Android: layout_width = "fill_parent"
- Android: layout_height = "wrap_content"
- Android: id = "@ + id/notice"
- Android: background = "@ color/black20"
- Android: text = "they said they wanted to put advertisements here to see if they could be moved! Long ...!!!!... "
- Android: ellipsize = "marquee"
- Android: gravity = "center"
- Android: textStyle = "bold"
- <Span style = "color: # ff0000;"> android: focusable = "true"
- Android: marqueeRepeatLimit = "marquee_forever"
- Android: focusableInTouchMode = "true"
- Android: scrollHorizontally = "true"
- Android: singleLine = "true" </span>
- Android: textSize = "@ dimen/activity_Textsize15_4.0"
- />
Note that the content must be long enough to scroll, otherwise it will not scroll. The Code marked in red is the key code.