Android教程網
  1. 首頁
  2. Android 技術
  3. Android 手機
  4. Android 系統教程
  5. Android 游戲
 Android教程網 >> Android技術 >> 關於Android編程 >> Android常用UI組件 - TextView

Android常用UI組件 - TextView

編輯:關於Android編程

TextView是Android裡面用的最多的UI組件,一般使用在需要顯示一些信息的時候,其不能輸入,只能初始設定或者在程序中修改。
實例:TextViewDemo 運行效果: \
代碼清單:<喎?/kf/ware/vc/" target="_blank" class="keylink">vc3Ryb25nPgqyvL7WzsS8/qO6bWFpbi54bWwKPHByZSBjbGFzcz0="brush:java;"> 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);
    }
}


API知識點 Activity public class Activity extends ContextThemeWrapper implements ComponentCallbacks2 KeyEvent.Callback LayoutInflater.Factory2 View.OnCreateContextMenuListener Window.Callback
Known Direct Subclasses AccountAuthenticatorActivity, ActivityGroup, AliasActivity, ExpandableListActivity, FragmentActivity, ListActivity, NativeActivity
Known Indirect Subclasses LauncherActivity, PreferenceActivity, TabActivity
void setContentView(int layoutResID) Set the activity content from a layout resource.
TextView public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
Known Direct Subclasses Button, CheckedTextView, Chronometer, DigitalClock, EditText, TextClock
Known Indirect Subclasses AutoCompleteTextView, CheckBox, CompoundButton, ExtractEditText, MultiAutoCompleteTextView, RadioButton, Switch, ToggleButton
Class Overview 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.
Public Constructors TextView(Context context) TextView(Context context, AttributeSet attrs) TextView(Context context, AttributeSet attrs, int defStyle)
  1. 上一頁:
  2. 下一頁:
熱門文章
閱讀排行版
Copyright © Android教程網 All Rights Reserved