標籤:android style http color io os ar java for
布局檔案: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="這裡是TextView,你可以在這裡顯示一些文本資訊。"
- />
- </LinearLayout>
Java原始碼檔案: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);
- }
Displays text to the user and optionally allows them to edit it. A TextView is a complete text editor, however the basic class is configured to not allow editing; see EditText for a subclass that configures the text view for editing.TextView(Context context, AttributeSet attrs, int defStyle)
Android常用UI組件 - TextView