My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for

UI 速查表

表單元件

選單與狀態提示元件 版面配置元件

階層檢視工具

TextView  
TextView 文字欄位
Updated Apr 26, 2011 by gasolin

XML宣告

<TextView  android:id="@+id/txt1"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="string"
    />

Code

Import

import android.widget.TextView;

Xml Binding

TextView txt = (TextView)findViewById(R.id.txt1);

文字

get text

txt.getText().toString();

set text

txt.setText("any string");

更多文字類型

<TextView  android:id="@+id/txt1"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:text="string"
    android:textSize="24dp"
    android:textStyle="italic"
    />

參考文件

http://developer.android.com/reference/android/widget/TextView.html


Sign in to add a comment
Powered by Google Project Hosting