SlideShare a Scribd company logo
1 of 21
Android 程式設計(3)
講師:王瑋毅
概要
• Android Adapter 介紹
• Android的UI設計
• CheckBox
• DatePicker
• TimePicker
• ProgressBar
• AlertDialog
• Spinner
• ListView
• GridView
Android UI – CheckBox(1/2)
• CheckBox 是一個勾選方塊,通常用在多選
Android UI – CheckBox(2/2)
• 設定CheckBox 選擇事件
Android UI – DatePicker(1/2)
• DatePicker 可以跳出一個日期選擇框,提供選擇
Android UI – DatePicker(2/2)
• 設置DatePickerDialog 選擇器
Android UI – TimePicker(1/2)
• TimePicker 可以跳出一個時間選擇框,提供選擇
Android UI – TimePicker(2/2)
• 設置TimePicker 選擇器
Android UI – ProgressBar(1/2)
• ProgressBar 是一種顯示進度的元件
• 只有水平進度條可設定主、次要進度值
Android UI – ProgressBar(2/2)
• style常用到參數如下
屬性 功能描述
style=“?android:attr/progressBarStyleHorizontal” 水平狀進度條。
style=“?android:style/widget/ProgressBar” 環形進度條。
style=“?android:attr/progressBarStyleSmall” 小環形進度條。
style=“?android:attr/progressBarStyle” 中環形進度條。
style=“?android:attr/progressBarStyleLarge” 大環形進度條。
style=“?android:attr/progressBarStyleSmallInverse” 小環形反白進度條。
style=“?android:attr/progressBarStyleInverse” 中環形反白進度條。
style=“?android:attr/progressBarStyleLargeInverse” 大環形反白進度條。
Android UI - AlertDialog(1/3)
• AlertDialog 可在原有的Activity上彈跳出
一個對話視窗
Android UI - AlertDialog(2/3)
• AlertDialog 可自己定義畫面,以下自定義一個
輸入名字的視窗,建一個item_layout.xml
Android UI – AlertDialog (3/3)
• 實作Button2 和自定義Dialog 事件
Android Adapter 介紹
• Adapter 是用來連接資料和資料顯示的
• 常用Adapter
• ArrayAdapter 當資料來源是陣列或List集合可使用,ex: Spinner, ListView
• SimpleAdapter 當資料來源是表格或Map集合可使用,ex: GridView
• BaseAdapter 客製化需求時,繼承BaseAdapter在實作
Android UI – Spinner(1/2)
• Spinner 主要用在做下拉選單的選擇
Android UI – Spinner(2/2)
• 設定Spinner 選擇事件
Android UI – ListView (1/2)
• ListView 通常用來顯示條列式資訊
Android UI – ListView (2/2)
• 設置ListView選取項目事件
Android UI – GridView(1/2)
• GridView 是一種網格狀的二維視覺元件
• 紅框為設置GridView其中一個item,命名grid_item.xml
Android UI – GridView(2/2)
• 設置GridView九宮格
謝謝大家

More Related Content

Similar to Android 程式設計(3)

Android应用开发 - 沈大海
Android应用开发 - 沈大海Android应用开发 - 沈大海
Android应用开发 - 沈大海Shaoning Pan
 
Android hw accelerated_2d_rendering
Android hw accelerated_2d_renderingAndroid hw accelerated_2d_rendering
Android hw accelerated_2d_renderingGump Law
 
Android开发基础
Android开发基础Android开发基础
Android开发基础ykdsg
 
Android GDB Debugging (Chinese)
Android GDB Debugging (Chinese)Android GDB Debugging (Chinese)
Android GDB Debugging (Chinese)William Lee
 
Android 智慧型手機程式設計
Android 智慧型手機程式設計Android 智慧型手機程式設計
Android 智慧型手機程式設計Kyle Lin
 
Windows Mobile 多媒體應用程式開發
Windows Mobile 多媒體應用程式開發Windows Mobile 多媒體應用程式開發
Windows Mobile 多媒體應用程式開發建興 王
 
Android 4-app
Android 4-appAndroid 4-app
Android 4-applydiafly
 
Kindeditor 设计思路
Kindeditor 设计思路Kindeditor 设计思路
Kindeditor 设计思路luolonghao
 
《淘宝客户端 for Android》项目实战
《淘宝客户端 for Android》项目实战《淘宝客户端 for Android》项目实战
《淘宝客户端 for Android》项目实战完颜 小卓
 
Mobile web開發架構與入門
Mobile web開發架構與入門Mobile web開發架構與入門
Mobile web開發架構與入門Chi-wen Sun
 
Athrun instrument driver
Athrun instrument driverAthrun instrument driver
Athrun instrument driverdrewz lin
 
04.layman android google handheld device application design
04.layman android   google handheld device application design04.layman android   google handheld device application design
04.layman android google handheld device application designgaquay086
 
Windows Mobile 多媒體應用程式開發
Windows Mobile 多媒體應用程式開發Windows Mobile 多媒體應用程式開發
Windows Mobile 多媒體應用程式開發Chui-Wen Chiu
 
Android裝置開發過程的軟硬整合關鍵及挑戰
Android裝置開發過程的軟硬整合關鍵及挑戰Android裝置開發過程的軟硬整合關鍵及挑戰
Android裝置開發過程的軟硬整合關鍵及挑戰tick
 
Kind editor设计思路
Kind editor设计思路Kind editor设计思路
Kind editor设计思路taobao.com
 
Note app功能介紹
Note app功能介紹Note app功能介紹
Note app功能介紹Json Liang
 

Similar to Android 程式設計(3) (17)

Android应用开发 - 沈大海
Android应用开发 - 沈大海Android应用开发 - 沈大海
Android应用开发 - 沈大海
 
Android hw accelerated_2d_rendering
Android hw accelerated_2d_renderingAndroid hw accelerated_2d_rendering
Android hw accelerated_2d_rendering
 
Android
AndroidAndroid
Android
 
Android开发基础
Android开发基础Android开发基础
Android开发基础
 
Android GDB Debugging (Chinese)
Android GDB Debugging (Chinese)Android GDB Debugging (Chinese)
Android GDB Debugging (Chinese)
 
Android 智慧型手機程式設計
Android 智慧型手機程式設計Android 智慧型手機程式設計
Android 智慧型手機程式設計
 
Windows Mobile 多媒體應用程式開發
Windows Mobile 多媒體應用程式開發Windows Mobile 多媒體應用程式開發
Windows Mobile 多媒體應用程式開發
 
Android 4-app
Android 4-appAndroid 4-app
Android 4-app
 
Kindeditor 设计思路
Kindeditor 设计思路Kindeditor 设计思路
Kindeditor 设计思路
 
《淘宝客户端 for Android》项目实战
《淘宝客户端 for Android》项目实战《淘宝客户端 for Android》项目实战
《淘宝客户端 for Android》项目实战
 
Mobile web開發架構與入門
Mobile web開發架構與入門Mobile web開發架構與入門
Mobile web開發架構與入門
 
Athrun instrument driver
Athrun instrument driverAthrun instrument driver
Athrun instrument driver
 
04.layman android google handheld device application design
04.layman android   google handheld device application design04.layman android   google handheld device application design
04.layman android google handheld device application design
 
Windows Mobile 多媒體應用程式開發
Windows Mobile 多媒體應用程式開發Windows Mobile 多媒體應用程式開發
Windows Mobile 多媒體應用程式開發
 
Android裝置開發過程的軟硬整合關鍵及挑戰
Android裝置開發過程的軟硬整合關鍵及挑戰Android裝置開發過程的軟硬整合關鍵及挑戰
Android裝置開發過程的軟硬整合關鍵及挑戰
 
Kind editor设计思路
Kind editor设计思路Kind editor设计思路
Kind editor设计思路
 
Note app功能介紹
Note app功能介紹Note app功能介紹
Note app功能介紹
 

More from Roy Wang

Android程式設計(7)
Android程式設計(7)Android程式設計(7)
Android程式設計(7)Roy Wang
 
Android 程式設計(5)
Android 程式設計(5)Android 程式設計(5)
Android 程式設計(5)Roy Wang
 
Android 程式設計(4)
Android 程式設計(4)Android 程式設計(4)
Android 程式設計(4)Roy Wang
 
Android 程式設計(2)
Android 程式設計(2)Android 程式設計(2)
Android 程式設計(2)Roy Wang
 
App inventor 5
App inventor 5App inventor 5
App inventor 5Roy Wang
 
App inventor 4
App inventor 4App inventor 4
App inventor 4Roy Wang
 
App inventor 3
App inventor 3App inventor 3
App inventor 3Roy Wang
 
App inventor 2
App inventor 2App inventor 2
App inventor 2Roy Wang
 

More from Roy Wang (8)

Android程式設計(7)
Android程式設計(7)Android程式設計(7)
Android程式設計(7)
 
Android 程式設計(5)
Android 程式設計(5)Android 程式設計(5)
Android 程式設計(5)
 
Android 程式設計(4)
Android 程式設計(4)Android 程式設計(4)
Android 程式設計(4)
 
Android 程式設計(2)
Android 程式設計(2)Android 程式設計(2)
Android 程式設計(2)
 
App inventor 5
App inventor 5App inventor 5
App inventor 5
 
App inventor 4
App inventor 4App inventor 4
App inventor 4
 
App inventor 3
App inventor 3App inventor 3
App inventor 3
 
App inventor 2
App inventor 2App inventor 2
App inventor 2
 

Android 程式設計(3)

  • 2. 概要 • Android Adapter 介紹 • Android的UI設計 • CheckBox • DatePicker • TimePicker • ProgressBar • AlertDialog • Spinner • ListView • GridView
  • 3. Android UI – CheckBox(1/2) • CheckBox 是一個勾選方塊,通常用在多選
  • 4. Android UI – CheckBox(2/2) • 設定CheckBox 選擇事件
  • 5. Android UI – DatePicker(1/2) • DatePicker 可以跳出一個日期選擇框,提供選擇
  • 6. Android UI – DatePicker(2/2) • 設置DatePickerDialog 選擇器
  • 7. Android UI – TimePicker(1/2) • TimePicker 可以跳出一個時間選擇框,提供選擇
  • 8. Android UI – TimePicker(2/2) • 設置TimePicker 選擇器
  • 9. Android UI – ProgressBar(1/2) • ProgressBar 是一種顯示進度的元件 • 只有水平進度條可設定主、次要進度值
  • 10. Android UI – ProgressBar(2/2) • style常用到參數如下 屬性 功能描述 style=“?android:attr/progressBarStyleHorizontal” 水平狀進度條。 style=“?android:style/widget/ProgressBar” 環形進度條。 style=“?android:attr/progressBarStyleSmall” 小環形進度條。 style=“?android:attr/progressBarStyle” 中環形進度條。 style=“?android:attr/progressBarStyleLarge” 大環形進度條。 style=“?android:attr/progressBarStyleSmallInverse” 小環形反白進度條。 style=“?android:attr/progressBarStyleInverse” 中環形反白進度條。 style=“?android:attr/progressBarStyleLargeInverse” 大環形反白進度條。
  • 11. Android UI - AlertDialog(1/3) • AlertDialog 可在原有的Activity上彈跳出 一個對話視窗
  • 12. Android UI - AlertDialog(2/3) • AlertDialog 可自己定義畫面,以下自定義一個 輸入名字的視窗,建一個item_layout.xml
  • 13. Android UI – AlertDialog (3/3) • 實作Button2 和自定義Dialog 事件
  • 14. Android Adapter 介紹 • Adapter 是用來連接資料和資料顯示的 • 常用Adapter • ArrayAdapter 當資料來源是陣列或List集合可使用,ex: Spinner, ListView • SimpleAdapter 當資料來源是表格或Map集合可使用,ex: GridView • BaseAdapter 客製化需求時,繼承BaseAdapter在實作
  • 15. Android UI – Spinner(1/2) • Spinner 主要用在做下拉選單的選擇
  • 16. Android UI – Spinner(2/2) • 設定Spinner 選擇事件
  • 17. Android UI – ListView (1/2) • ListView 通常用來顯示條列式資訊
  • 18. Android UI – ListView (2/2) • 設置ListView選取項目事件
  • 19. Android UI – GridView(1/2) • GridView 是一種網格狀的二維視覺元件 • 紅框為設置GridView其中一個item,命名grid_item.xml
  • 20. Android UI – GridView(2/2) • 設置GridView九宮格