android第二章控件1
1.Activity:用於存放各個顯示控件,是android的基本組成
2.Activity常用方法:public final View findViewById(int id) 根據組件的id取得組件對象 public void setContentView(int layoutResIdd) 設置顯示組件
3.設置控件的ID值:格式:@+id/ID值
4.TextView標簽(標簽按鈕):
4.1常用屬性:1:android:text //定義組件的顯示文字
2: textColor: //設置文件的文本顏色
3: textSize: //設置顯示的文字大小
4: textStyle: //設置文字顯示的樣式、粗體、斜體
4.2設置文字的顯示風格: normal(正常)、bold(粗體)、italic(斜體)
4.3設置組件大小或文字大小:
px:像素;dip:依賴於設備的像素;
sp:帶比例的像素;pt:點;in:英尺;
mm:毫米
5. getText().toString() //獲得控件的文本內容 setText(); //設置控件的文本內容
6. Button按鈕:
6.14.1常用屬性:1:android:text //定義組件的顯示文字
2: textColor: //設置文件的文本顏色
3. enable="flase or ture" //值為false時不能按
7.EditText按鈕(文本編輯寬)
7.1常用屬性:1:android:text //定義組件的顯示文字
2: textColor: //設置文件的文本顏色
3. enable="flase or ture" //值為false時文本框不能編輯
android第二章控件1