Android View (Android learning note)

Source: Internet
Author: User

Android View class:

1. All Android components are sub-classes of view.

2. All components can be configured in two configurations, one through the method. The second is to configure through XML.

TextView class:

1. For text components The main purpose is to statically display some text, similar to the function of the label.

2. It is the Android.widget.TextView class and is a direct subclass of the Android.view.View class.

3. How to insert a hyperlink:

1) write in the TextView component configuration in the XML file: android:autolink= "All" is automatically configured. Note: Symbols must be in English.

2) in the activity, write as follows:
<span style= "Font-family:simsun;" >string html + = "<big><i><a href= ' http://www.baidu.com ' > Feel free to contact me </a></I></big> "; Charsequence charsequence = html.fromhtml (Html); Textview1.settext (charsequence); Textview1.setmovementmethod ( Linkmovementmethod.getinstance ());</span>

The textview1 is then the form of a hyperlink.


About style sheet files:


There may be many components in Android, which can be cumbersome if one is configured. So we can use the style sheet file for one by one configuration. The effort to develop and maintain is eliminated.

The generic style sheet file is saved in the Values folder under the project's Res folder. File is Style.xml

How to define:

<span style= "Font-family:simsun;" ><resources>   <style name= "style name" parent= "Parent style sheet" >       <item name= "defined Properties" > property Contents </item>   </style></resources></span>

Its reference is referenced by the name defined within name.


Defined:

<span style= "Font-family:simsun;" >resources xmlns:android= "Http://schemas.android.com/apk/res/android" >   <style name= "Msg_style" >- --Define the style name of the component       <item name= "android:textsize" >45dp</item>       <item name= "Android:textcolor" > #00FF00 </item>       <item name= "Android:textstyle" >bold|italic</item>   </style> </resources></span>

References:

<span style= "Font-family:simsun;" ><textview       android:id= "@+id/textview1"       style= "@style/msg_style"/></span>


Android View (Android learning note)

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.