Using TextView for android

Source: Internet
Author: User

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)

  1. <TextView
  2. Android: layout_width = "fill_parent"
  3. Android: layout_height = "wrap_content"
  4. Android: id = "@ + id/notice"
  5. Android: background = "@ color/black20"
  6. Android: text = "they said they wanted to put advertisements here to see if they could be moved! Long ...!!!!... "
  7. Android: ellipsize = "marquee"
  8. Android: gravity = "center"
  9. Android: textStyle = "bold"
  10. <Span style = "color: # ff0000;"> android: focusable = "true"
  11. Android: marqueeRepeatLimit = "marquee_forever"
  12. Android: focusableInTouchMode = "true"
  13. Android: scrollHorizontally = "true"
  14. Android: singleLine = "true" </span>
  15. Android: textSize = "@ dimen/activity_Textsize15_4.0"
  16. />

 

Note that the content must be long enough to scroll, otherwise it will not scroll. The Code marked in red is the key code.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.