1. 程式人生 > >Activity常用的方法

Activity常用的方法

and 顏色 根據 ring true 不可用 text 字符 size


1. View findViewById(int id) //根據組件ID取得組件對象
setContentView(int LayoutResID) //設置布局文件,設置顯示組件

2. TextView
android:maxLength="6" //允許最大字符數
android:textColor="#FF0000" //文字的顏色
android:textSize="50px" //文字的大小
android:textStyle="bold" //文字樣式
android:password="true" //是否以密方式顯示
android:layout-margin="100px" //外邊距
android:background="@drawable/a" //背景
android:id="@+id/id值" //設置id的值

getText() .tostring() //獲取空間文本內容
setText() ; // 設置空間文本內容

註意<!---->: 註釋
3. Button
4.EditText
android:enabled="false" //設置 是否可用,false不可用

Activity常用的方法