Tru Xi的相關與近況相關紀錄與Android App

2014/11/25

【學習】常用的介面元件屬性

TextView:在螢幕中顯示訊息的元件
android:id 設定所屬元件的識別符號
android:text 設定元件中的內容來源
android:textSize 設定字體大小
android:textColor 設定自行顏色
android:gravity
 
  • center 設定元件水平、垂直置中對齊 
  • center_horizontal 設定元件水平置中對齊

EditText:在螢幕中讓使用者輸入資料的元件
android:number

  • integer 允許輸入數值為整數 
  • decimal 允許輸入數值為小數
android:inputType  

  • number 設定輸入格視為數字 
  • textPassword 設定輸入格式為密碼 
  • numberDecimal 允許輸入小數型態的數字

android:hint 提示文字
android:maxLength 設定最多的輸入長度

ImageButton:圖形按鈕元件
androidLsrc 設定按鈕上的圖形來源


Spinner:下拉式選項元件
android:prompt 設定下拉式選單一開始所顯示的字串


ImageView:顯示圖片的元件
android;src 設定圖片來源

RadioGroup:用來產生一個多選一的選單、裡面的選項為 RadioButton
android:orientation 設定 RadioGroup 裡的元件排列方向
android:checkedButton 自動選取的預設選項

SurfaceView:繪圖的元件
android:visibility 設定可見度

com.google.android.maps.MapView:Google地圖元件
android:enabled 設定是否能啟動應用程序
android:clickable 設定是否能與應用程序互動
android:apiKey 設定使用者已取得地圖服務的認證




ListView:以垂直捲軸式清單來顯示資料內容

CheckedTextView:用在 ListView 的顯示裡,顯示的內容可讓使用者點選

CheckBox:可供選擇的選項 , 選與不選 ,  二擇一


Button:按鈕元件

常用的介面元件屬性
android:id
android:layout_width android:layout_height android:text
android:inputType text android:background  android:textSize
android:textColor android:password android:autoLink
android:hint
android:layout_margin
android:layout_marginLefr  android:layout_marginRight android:layout_marginTop android:layout_marginBottom
android:padding
android:paddingLeft android:paddingRight android:paddingTop android:paddingBottom
android:gravity android:layout_gravity
android:layout_weight

介面元件的屬性可以使用的長度單位
pxptdpspmmin

沒有留言: