Focus on technology, enjoy life! --qq:804212028
Browse Links: http://blog.csdn.net/y18334702058/article/details/44624305
- Topic: TextView of the user interface (text view)
TextView Control instance:
Activity_main.xml Source code:
<?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" ; <TextViewandroid:id= "@+id/tv"android:layout_height="Wrap_ Content "android:layout_width=" Fill_parent "android:text=" Egg " Android:textsize="20sp"android:textcolor="#003366" /> </linearlayout>
Instantiate it in Mainactivity.java:
import android.app.Activity ; import android.os.Bundle; import Android.widget.TextView; public class mainactivity Span class= "Hljs-keyword" >extends activity { private TextView TV; @Override protected void oncreate (Bundle savedinstancestate) {super . OnCreate (savedinstancestate); Setcontentview (R.layout.activity_main); //instantiate TextView TV = (TextView) Findviewbyid (r.id.tv); }}
Operation Result:
TextView Common Properties:
| Property name |
Description |
| Android:editable |
If set, specifies that the TextView has an input method, and if there is no special designation, it is the text input state. |
| Android:hint |
The prompt message that appears when the text is empty. |
| Android:inputtype |
The type of data that can be placed in a text field to help the input method decide how to let the user enter text. |
| Android:maxlength |
Sets the input filter to limit the maximum length of text entered to the specified value. |
| Android:password |
Whether to display the characters in the text field as dots that represent the password. |
| Android:text |
The text to display |
| Android:textcolor |
Text color |
| Android:textsize |
The size of the text. It is recommended to set this value (such as 15SP) in "sp (scaling pixel)" units. |
| Android:textstyle |
Text Style (bold, italic, bold italic, etc.). |
Focus on technology, enjoy life! --qq:804212028
Browse Links: http://blog.csdn.net/y18334702058/article/details/44624305
Step by Step _android Development Course [15]_ User interface TextView (text view)