Multiple textview lawn lights developed by Android

Source: Internet
Author: User

The marquee is that textview cannot accommodate content and must be displayed in the form of a playback animation.

1, usually, many people only need to implement a textview of the horse, just need to add the following section in the textview attributes (specific parameters represent the meaning, please refer to here http://www.cnblogs.com/over140/archive/2010/08/27/1809745.html)

 

android:layout_marginRight="20dp"           android:ellipsize="marquee"       android:focusable="true"       android:marqueeRepeatLimit="marquee_forever"       android:focusableInTouchMode="true"       android:scrollHorizontally="true"    android:singleLine="true"

2. If you need to implement multiple textviews on the same page, you will find that there is always only one textview, and nothing else works. Why? Because there is a very important parameter for the implementation of the running horse lamp effect, that is, whether it is isfocused. Therefore, you only need to inherit textview and override the isfocused method, as shown below:

 

 

public class TextViewMarquee extends TextView {public TextViewMarquee(Context context) {super(context);}public TextViewMarquee(Context context, AttributeSet attrs, int defStyle) {super(context, attrs, defStyle);}public TextViewMarquee(Context context, AttributeSet attrs) {super(context, attrs);}@Overridepublic boolean isFocused() {return true;}}

Hope to help you!

 

 

Related Article

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.