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, you can display some textual information here. "
- />
- </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 savedinstancestate)
- {
- super.oncreate (savedinstancestate);
- Setcontentview (R.layout.main);
- }
< Span style= "color: #262626; font-family: ' Courier New '; >< Span style= "color: #262626; font-family: ' Courier New '; >displays 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. TextView (Context context, AttributeSet attrs, int defstyle)
Android Common UI Components-TextView