Android Common UI Components-TextView

Source: Internet
Author: User

TextView is the most UI component used in Android, and is generally used when you need to display some information, it cannot be entered, can only be set initially or modified in the program.
Example: Textviewdemo Operating Effect:
Code Listing:layout file: Main.xml
<?xml version= "1.0" encoding= "Utf-8"? ><linearlayout xmlns:android= "http://schemas.android.com/apk/res/ Android "    android:orientation=" vertical "    android:layout_width=" fill_parent "    android:layout_height=" Fill_parent "    ><textview    android:layout_width=" fill_parent "    android:layout_height=" Wrap_ Content "    android:text=" Here is TextView, where you can display some textual information. "    /></linearlayout>
Java source code file: Mainactivity.java
Package Com.rainsong.textviewdemo;import Android.app.activity;import Android.os.bundle;public class MainActivity Extends activity{    /** called when the Activity is first created. *    /@Override public    void OnCreate (Bundle save Dinstancestate)    {        super.oncreate (savedinstancestate);        Setcontentview (R.layout.main);    }}


API Knowledge Points ActivityPublic classActivityextends Contextthemewrapperimplements COMPONENTCALLBACKS2 Keyevent.callback Layoutinflater.factory2 View.oncreatecontextmenulistener Window.callback
known Direct subclassesaccountauthenticatoractivity, Activitygroup, aliasactivity, expandablelistactivity, FragmentActivity, Listactivity, Nativeactivity
known Indirect subclasseslauncheractivity, preferenceactivity, tabactivity
void Setcontentview (int layoutresid)Set the activity content from a layout resource.
TextViewPublic classTextViewextends Viewimplements Viewtreeobserver.onpredrawlistener
known Direct subclassesButton, Checkedtextview, chronometer, DigitalClock, EditText, Textclock
known Indirect subclassesAutocompletetextview, CheckBox, Compoundbutton, Extractedittext, Multiautocompletetextview, RadioButton, Switch, ToggleButton
Class Overviewdisplays text to the user and optionally allows them to edit it. A TextView is a complete text editor, however the basic class was configured to not allow editing; See EditText for a subclass this configures the text view for editing.
Public ConstructorsTextView (Context context)TextView (Context context, AttributeSet attrs)TextView (Context context, AttributeSet attrs, int defstyle)

Android Common UI Components-TextView

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.