日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

04 高级控件总结

發布時間:2024/3/26 编程问答 33 豆豆
生活随笔 收集整理的這篇文章主要介紹了 04 高级控件总结 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1,Spinner
?? ?>概念;下拉菜單控件 默認顯示當前選擇的項(第一次展示集合中第一條數據)
?? ?>屬性:
?? ??? ?android:entries="@array/books"? 展示數據? (note:提前知道數據是什么 )
?? ????? android:spinnerMode="dropdown" spinner 樣式
?? ????? dropdown:下拉列表???? 設置popupBackground? 每一項的背景顏色
?? ????? dialog:彈出框????????????? 設置prompt?? 標題????? 調用的是Values/string.xml/string ?

???? >監聽:setOnItemSelectedListener
?? ?
2,什么是Adapter?
?? ?>適配器? 將數據轉換成控件識別的形式

?? ?>子類:BaseAdapter(下周)??? ArrayAdapter???? SimpleAdapter
?? ?
3,ArrayAdapter的使用?
?? ?>一般用于只有String類型數據? 展示到TextView上

?? ?>如果三個參數的ArrayAdapter?? item布局的根節點 必須是TextView
???????? 如果跟節點不是TextVIew 三個參數的會報錯????? 使用四個參數的ArrayAdapter
?? ?
4,SimpleAdapter的使用:
?? ?>處理復雜的數據?? (帶有圖片和文字)

?? ??? Context context:?? 上下文
?????????? List<? extends Map<String, ?>> data:? 數據源
???????????? int resource:? 布局
???????????? String[] from:? 數據源中帶key的數組
???????????? int[] to???? :? 布局資源中id的數組
??????????? ?
???????????? note:from里的key和to里的控件id? 是對應關系

5,AutoCompleteTextView
?? ?>自動索引的EditText(文本輸入框)

?? ?> 默認輸入倆個字符? 才開始索引
????????? android:completionThreshold="1" 輸入幾個字符開始索引
?? ??? ?
6,addTextChangedListener()的用法?

?? ?>
?? ?
?????? ?
??????? //文本發生變化的監聽?? 可以對EditText操作 ?
??????? autoView.addTextChangedListener(new TextWatcher() {
?? ??? ??? ?
?????? ??? ?/**
?????? ??? ? * 改變文本時調用
?????? ??? ? * CharSequence s:變化之后的文本
?????? ??? ? * int start:變化的起點? 從哪里開始改變
?????? ??? ? * int before: 相比較文本變化? 添加沒有改變0???? 刪除改變
?????? ??? ? * int count:相比較文本變化???? 添加有值????????? 刪除沒有改變0
?????? ??? ? */
?? ??? ??? ?@Override
?? ??? ??? ?public void onTextChanged(CharSequence s, int start, int before, int count) {
?? ??? ??? ??? ?// TODO Auto-generated method stub
?? ??? ??? ??? ?Log.e("AAA", "==onTextChanged==s:"+s+"=start:"+start+"=before:"+before+"=count:"+count);
?? ??? ??? ?}
?? ??? ??? ?
?? ??? ??? ?/**
?????? ??? ? * 改變文本之前調用
?????? ??? ? * CharSequence s:變化之前的文本
?????? ??? ? * int start:變化之前的文本下標
?????? ??? ? * int count:相比較文本的變化?? 添加不變的0?? 刪除是改變:刪除幾個展示結果
?????? ??? ? * int after:相比較文本的變化???? 如果添加是有值??? 如果刪除不變?? 0
?????? ??? ? */
?? ??? ??? ?@Override
?? ??? ??? ?public void beforeTextChanged(CharSequence s, int start, int count,
?? ??? ??? ??? ??? ?int after) {
?? ??? ??? ??? ?// TODO Auto-generated method stub
?? ??? ??? ??? ?Log.e("AAA", "==beforeTextChanged==s:"+s+"=start:"+start+"=count:"+count+"=after:"+after);
?? ??? ??? ??? ?
?? ??? ??? ?}
?? ??? ??? ?/**
?????? ??? ? * 改變文本之后調用
?????? ??? ? * Editable s:改變之后的文本
?????? ??? ? */
?? ??? ??? ?@Override
?? ??? ??? ?public void afterTextChanged(Editable s) {
?? ??? ??? ??? ?// TODO Auto-generated method stub
?? ??? ??? ??? ?Log.e("AAA", "==afterTextChanged==s:"+s);
?? ??? ??? ?}
?? ??? ?});
?? ?

?? ?/**
???????? * 08-25 15:23:44.334: E/AAA(12812): ==beforeTextChanged==s:=start:0=count:0=after:1
?? ??? ??? ?08-25 15:23:44.334: E/AAA(12812): ==onTextChanged==s:g=start:0=before:0=count:1
?? ??? ??? ?08-25 15:23:44.334: E/AAA(12812): ==afterTextChanged==s:g
?? ??? ??? ?08-25 15:23:45.904: E/AAA(12812): ==beforeTextChanged==s:g=start:1=count:0=after:1
?? ??? ??? ?08-25 15:23:45.904: E/AAA(12812): ==onTextChanged==s:gh=start:1=before:0=count:1
?? ??? ??? ?08-25 15:23:45.904: E/AAA(12812): ==afterTextChanged==s:gh
?? ??? ??? ?08-25 15:23:47.824: E/AAA(12812): ==beforeTextChanged==s:gh=start:2=count:0=after:1
?? ??? ??? ?08-25 15:23:47.824: E/AAA(12812): ==onTextChanged==s:ghj=start:2=before:0=count:1
?? ??? ??? ?08-25 15:23:47.824: E/AAA(12812): ==afterTextChanged==s:ghj
?? ??? ??? ?08-25 15:23:49.164: E/AAA(12812): ==beforeTextChanged==s:ghj=start:2=count:1=after:0
?? ??? ??? ?08-25 15:23:49.164: E/AAA(12812): ==onTextChanged==s:gh=start:2=before:1=count:0
?? ??? ??? ?08-25 15:23:49.164: E/AAA(12812): ==afterTextChanged==s:gh
?? ??? ??? ?08-25 15:23:49.694: E/AAA(12812): ==beforeTextChanged==s:gh=start:1=count:1=after:0
?? ??? ??? ?08-25 15:23:49.694: E/AAA(12812): ==onTextChanged==s:g=start:1=before:1=count:0
?? ??? ??? ?08-25 15:23:49.694: E/AAA(12812): ==afterTextChanged==s:g

???????? */

總結

以上是生活随笔為你收集整理的04 高级控件总结的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。