freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

第5章android用戶界面-展示頁

2025-07-29 11:28本頁面
  

【正文】 inner ? SpinnerDemo在 XML文件中的代碼 ? 第 5行使用 Spinner標(biāo)簽聲明了一個 Spinner控件 ? 第 6行代碼中指定了該控件的寬度為 300dip 1. TextView android:id=+id/TextView01 2. android:layout_width=fill_parent 3. android:layout_height=wrap_content 4. android:text=string/hello/ 5. Spinner android:id=+id/Spinner01 6. android:layout_width=300dip 7. android:layout_height=wrap_content 8. /Spinner 界面控件 ? Spinner ? 在 ,定義一個 ArrayAdapter適配器,在 ArrayAdapter中添加需要在 Spinner中可以選擇的內(nèi)容 ,需要 在代碼中引入 1. Spinner spinner = (Spinner) findViewById()。 6. (radioButtonListener)。 7. (checkboxListener)。 1. checkboxListener = new (){ 2. Override 3. public void onClick(View v) { 4. //過程代碼 5. }}。 界面控件 ? CheckBox和 RadioButton ? CheckBox是一個同時可以選擇多個選項(xiàng)的控件 ? RadioButton則是僅可以選擇一個選項(xiàng)的控件 ? RadioGroup是 RadioButton的承載體,程序運(yùn)行時不可見,應(yīng)用程序中可能包含一個或多個 RadioGroup ? 一個 RadioGroup包含多個 RadioButton,在 每 個RadioGroup中,用戶僅能夠選擇其中一個 RadioButton 界面控件 ? CheckBox和 RadioButton ? 建立一個“ CheckboxRadiobuttonDemo”程序,包含五個控件, 從上至下分別是 TextView0 CheckBox0 CheckBox0 RadioButton0 RadioButton02 ? 當(dāng)選擇 RadioButton01, RadioButton02則無法選擇 界面控件 ? CheckBox和 RadioButton ? CheckboxRadiobuttonDemo在 XML文件中的代碼 1. TextView android:id=+id/TextView01“ 2. android:layout_width=fill_parent 3. android:layout_height=wrap_content 4. android:text=string/hello/ 5. CheckBox android:id=+id/CheckBox01 6. android:layout_width=wrap_content 7. android:layout_height=wrap_content 8. android:text=CheckBox01 9. /CheckBox 10. CheckBox android:id=+id/CheckBox02 11. android:layout_width=wrap_content 12. android:layout_height=wrap_content 13. android:text=CheckBox02 14. /CheckBox 界面控件 ? CheckBox和 RadioButton ? 第 15行 RadioGroup標(biāo)簽聲明了一個 RadioGroup ? 在第 18行和第 23行分別聲明了兩個 RadioButton,這兩個RadioButton是 RadioGroup的子元素 15. RadioGroup android:id=+id/RadioGroup01 16. android:layout_width=wrap_content 17. android:layout_height=wrap_content 18. RadioButton android:id=+id/RadioButton01 19. android:layout_width=wrap_content 20. android:layout_height=wrap_content“ 21. android:text=RadioButton01 22. /RadioButton 23. RadioButton android:id=+id/RadioButton02 24. android:layout_width=wrap_content 25. android:layout_height=wrap_content“ 26. android:text=RadioButton02 27. /RadioButton 28. /RadioGroup 界面控件 ? CheckBox和 RadioButton ? 引用 CheckBox和 RadioButton的方法參考下面的代碼 ? CheckBox設(shè)置點(diǎn)擊事件監(jiān)聽器 的 簡要代碼 ? 與 Button設(shè)置點(diǎn)擊事件監(jiān)聽器中介紹的方法相似,唯一不同在于將 1. CheckBox checkBox1= (CheckBox)findViewById()。 13. (buttonListener)。 10. return。 7. return。 10. } 11. })。 5. } 6. })。 界面控件 ? Button和 ImageButton ? 按鈕響應(yīng)點(diǎn)擊事件 : 添加點(diǎn)擊事件的監(jiān)聽器 ? 第 2行代碼 中 button對象通過調(diào)用 setOnClickListener()函數(shù),注冊一個點(diǎn)擊( Click)事件的監(jiān)聽器() ? 第 3行代碼是點(diǎn)擊事件的回調(diào)函數(shù) ? 第 4行代碼將 TextView的顯示內(nèi)容更改為“ Button按鈕” 1. final TextView textView = (TextView)findViewById()。 3. (Button按鈕 )。 界面控件 ? Button和 ImageButton ? Button是一種按鈕控件,用戶能夠在該控件上點(diǎn)擊,并后引發(fā)相應(yīng)的事件處理函數(shù) ? ImageButton用以實(shí)現(xiàn)能夠顯示圖像功能的控件按鈕 界面控件 ? Button和 ImageButton ? 建立一個“ ButtonDemo”的程序,包含 Button和ImageButton兩個按鈕, 上方 是 “ Button按鈕” , 下方是一個 ImageButton控件 界面控件 ? Button和 ImageButton ? ButtonDemo在 XML文件中的代碼 ? 定義 Button控 件的高度、寬度和內(nèi)容 ? 定義 ImageButton控件的高度和寬度,但是沒定義顯示的圖像,在后面的代碼中進(jìn)行定義 1. Button android:id=+id/Button01 2. android:layout_width=wrap_content 3. android:layout_height=wrap_content 4. android:text=Button01 5. /Button 6. ImageButton android:id=+id/ImageButton01 7. android:layout_width=wrap_content 8. android:layout_height=wrap_content 9. /ImageButton 界面控件 ? Button和ImageButton ? 引入資源 ? 將 /res/drawable文件夾下 ? 在 /res目錄上選擇 Refresh ? 新添加的文件將顯示在/res/drawable文件夾下 ? 新 ? 否則提示無法找到資源的錯誤 界面控件 ? Button和 ImageButton ? 更改 Button和 ImageButton內(nèi)容 ? 引入 ? 第 1行代碼用于引用在 XML文件中定義的 Button控件 ? 第 2行代碼用于引用在 XML文件中定義的 ImageButton控件 ? 第 3行代碼將 Button的顯示內(nèi)容更改為“ Button按鈕” ? 第 4行代碼利用 setImageResource()函數(shù),將新加入的 png文件 ImageButton 1. Button button = (Button)findViewById()。 3. (用戶名: )。系統(tǒng)控件更有利于幫助用戶進(jìn)行快速開發(fā),同時能夠使Android系統(tǒng)中應(yīng)用程序的界面保持一致性 ? 常見的系統(tǒng)控件包括 TextView、 EditText、Button、 ImageButton、 Checkbox、 RadioButton、 Spinner、 ListView和 TabHost 界面控件 ? TextView和 EditText ? TextView是一種用于顯示字符串的控件 ? EditText則是用來輸入和編輯字符串的控件 ? EditText是一個具有編輯功能的 TextView 界面控件 ? TextView和 EditText ? 建立一個“ TextViewDemo”的程序,包含 TextView和EditText兩個控件 ? 上方“用戶名”部分使用的是 TextView,下方的文字輸入框使用的是 EditText 界面控件 ? TextView和 EditText ? TextViewDemo在 XML文件中的代碼 1. TextView android:id=+id/TextView01 2. android:layout_width=wrap_content 3. android:layout_height=wrap_content 4. android:text=TextView01 5. /TextView 6. EditText android:id=+id/EditText01 7. android:layout_width=fill_parent 8. android:layout_height=wrap_content 9. android:text=EditText01 10. /EditText 界面控件 ? TextView和 EditText ? 第 1行 android:id屬性聲明了 TextView的 ID,這個 ID主要用于在代碼中引用這個 TextView對象 ? “ +id/TextView01”表示所設(shè)置的 ID值 ? 表示后面的字符串是 ID資源 ? 加號( +)表示需要建立新資源名稱,并添加到 件中 ? 斜杠后面的字符串( TextView01)表示新資源的名稱 ? 如果資源 不是新添加的,或?qū)儆?Android框架的 ID資源,則不需要使用加號( +),但必須添加 Android包的命名空間,例如 android:id=android:id/empty 界面控件 ? TextView和 EditText ? 第 2行的 android:layout_width屬性用來設(shè)置 TextView的寬度, wrap_content表示 TextView的寬度只要能夠包含所顯示的字符串即可 ? 第 3行的 android:layout_height屬性用來設(shè)置 TextView的高度 ? 第 4行表示 TextView所顯示的字符串,在后面將通過代碼更改 TextView的顯示內(nèi)容 ? 第 7行中“ fill_content”表示 EditText的寬度將等于父控件的寬度 界面控件 ? TextView和 EditText
點(diǎn)擊復(fù)制文檔內(nèi)容
語文相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1