[Android] Mobile defender Custom scrolling controls

Source: Internet
Author: User

TextView Control Settings single-line display android:singleline="true"

Set TextView start position display ellipsis,android:ellipsize="Start"

Set scrolling properties,android:ellipsize="Marquee"

The scroll effect is called when the control has the focus

Create a new UI Package

Create a new class Focusedtextview inherit the TextView of the system

Overriding construction methods

Overriding the isfoused () method, which returns true, allows it to have the focus, actually without focus, just to deceive the android system

Copy the full path of this class, go to the layout file, replace the original TextView

Java:

 PackageCom.qingguow.mobilesafe.ui;ImportAndroid.content.Context;ImportAndroid.util.AttributeSet;ImportAndroid.widget.TextView; Public classFocusedtextviewextendsTextView { PublicFocusedtextview (Context context) {Super(context); //TODO auto-generated Constructor stub    }     PublicFocusedtextview (Context context, AttributeSet attrs) {Super(context, attrs); //TODO auto-generated Constructor stub    }     PublicFocusedtextview (context context, AttributeSet attrs,intDefstyle) {        Super(context, attrs, Defstyle); //TODO auto-generated Constructor stub} @Override Public BooleanisFocused () {//TODO auto-generated Method Stub        return true; }    }

Layout:

  < Com.qingguow.mobilesafe.ui.FocusedTextView         Android:singleline = "true"         android:ellipsize= "marquee"        android:text= "Mobile Defender welcomes you, This mobile defender software does not contain any redundant service processes and does not contain any unnecessary content of the consumed resources "        android:layout_width=" Wrap_content "        Android:layout_height = "Wrap_content"         android:layout_margintop= "10DP"/>

Effect

[Android] Mobile defender Custom scrolling controls

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.