Android Phone defender--home Page

Source: Internet
Author: User

1, customizing the TextView to get focus

Focustextview.java

1  PackageCom.itheima.mobilesafe74.view;2 3 ImportAndroid.content.Context;4 ImportAndroid.util.AttributeSet;5 ImportAndroid.widget.TextView;6 7 /**8  * @authorGCP9 * Custom TextView to get the focusTen  */ One  Public classFocustextviewextendsTextView { A     //use to create controls through Java code -      PublicFocustextview (Context context) { -         Super(context); the     } -      -     //called by the system (with attribute + Contextual environment construction method) -      PublicFocustextview (Context context, AttributeSet attrs) { +         Super(context, attrs); -     } +  A     //constructed by system call (with attribute + Contextual environment construction method + layout file defined style file) at      PublicFocustextview (context context, AttributeSet attrs,intDefstyle) { -         Super(context, attrs, defstyle); -     } -      -     //override the method that gets the focus, called by the system, to get the focus by default when called - @Override in      Public BooleanisFocused () { -         return true; to     } +}
Focustextview

Activity_home.xml Custom Get focus This part of the code:

    <com.itheima.mobilesafe74.view.focustextview        android:layout_width= "match_parent"        android:layout_ height= "Wrap_content"        android:ellipsize= "marquee"        android:marqueerepeatlimit= "Marquee_forever        " android:padding= "5DP"        android:singleline= "true"        android:text= "fall quietly in autumn, leave a little secret, ah ah ah ah ah ah, oh ah ah ah ah ah ah ah ah ah ah!        android:textcolor= "#000" >    </com.itheima.mobilesafe74.view.FocusTextView>

  

Android Phone defender--home Page

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.