android:inputType="number" //定義欄位屬性,會自動跳出對應的鍵盤
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/editText1"
android:hint="數字 EditText" /> //欄位提示字元
inputType屬性表
| 值 | 說明 |
| none | 無 |
| text | 任何的字元 |
| textCapCharacters | 鍵盤英文為大寫 |
| textCapWords | 每一個英文單字字母為大寫 |
| textAutoCorrect | 自動完成,表示輸入完成後會自動跳入下一個EditText |
| textAutoComplete | 同textAutoCorrect |
| textMultiLine | 多行輸入 |
| textImeMultiLine | 輸入法多行(不一定有支援) |
| textNoSuggestions | 不提示 |
| textUri | 網址 |
| textEmailAddress | Email 地址 |
| textEmailSubject | Email 主旨 |
| textShortMessage | 短訊息 |
| textLongMessage | 長訊息 |
| textPersonName | 人名 |
| textPostalAddress | 地址 |
| textPassword | 密碼 |
| textVisiblePassword | 可見密碼 |
| textWebEditText | 網頁表單的本文格式 |
| textFilter | 本文篩選格式 |
| textPhonetic | 拼音輸入 |
| number | 數字鍵盤 |
| numberSigned | 帶有符號數字格式 |
| numberDecimal | 帶小數點的浮點數字格式 |
| phone | 電話格式 |
| datetime | 時間日期 |
| date | 日期鍵盤 |
| time | 時間鍵盤 |
<AutoCompleteTextView
android:hint="自動完成"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/txtAutoComplete" />
.cs檔內容(Adapter用法)
//AutoCompleteTextView
string[] data = { "aaa","abc", "abb", "app", "apk"}
//由資料來源建立Adapter
ArrayAdapter<string> source = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleDropDownItem1Line, data);
var txt = this.FindViewById<AutoCompleteTextView>(Resource.Id.txtAutoComplete);
//將資料Adapter設定給AutoCompleteTextView
txt.Adapter = source;
txt.Threshold = 1;//設定輸入幾個字後跳提示,預設為2
data(字串) ==> Adapter ==> AutoCompleteTextView
沒有留言:
張貼留言