SlideShare ist ein Scribd-Unternehmen logo
1 von 52
Downloaden Sie, um offline zu lesen
Android
Graphical User Interface
Agenda
Familiarize with the main types of GUI components
Layouts
Basic Widgets
Others
Menus
Using Menus
Menus is not consuming ‘much’ view space.
Android provides two types of menu known
as: options menu and context menu.
 The options menu is triggered by pressing the
hardware Menu button on the device, while
 The context menu is raised by a tap-and-hold on
the widget associated to the menu.
Using Menus
Example: Using an option menu
Options
available in
this context
Press Menu
Button
A max of six entries per
menu. Excess will be
displayed as part of the
More option
Example: Using an option menu
Available
Options in
this
context
Press Menu
button
Using Menus
Example :
Dealing with SMS
(text-messages)
by using the built-
in Messaging
app’s
context menu
Tap-&-Hold
Using Menus
Option and Context Menus may include:
1. Text
2. Icons
3. Radio Buttons
4. Check Boxes
5. Sub-menus
6. Short-cut keys
Example 1: Option Menu
Example 1: Option Menu
Example 1: Context Menu
Example 1: Using Option and Context Menu
The app shows two text boxes. Menus are used to change text’s size, color, and
style.
Example 1: Using Option and Context Menu
The app shows two text boxes. Menus are used to change text’s size, color, and style.
Example 1: Using Option and Context Menu
The app shows two text boxes. Menus are used to change text’s size, color, and style.
Example 1: Using Option and Context Menu
Example 1: Using Option and Context Menu
Example 1: Using Option and Context Menu
Example 1: Using Option and Context Menu
Comments on Creating an Option & Context
Menu
Step1.
Indicate which widget(s) on your activity have context menus. To do this, call
registerForContextMenu(theWidget)
supplying the View that is the widget needing a context menu.
Step2.
Implement onCreateContextMenu(…), populate your menu adding
text, icons, etc. to the different options.Use input menu parameter
to determine which menu to build (assuming your activity has
more than one).
The onCreateContextMenu()method gets the Context Menu itself, the View the context
menu is associated with, and a ContextMenu. ContextMenuInfo, which tells you which item in
the list the user did the tap-and-hold over, in case you want to customize the context menu
based on that information
Comments on Creating an Option & Context Menu
•onCreateContextMenu() is called each time the context menu
is requested.
•Unlike the options menu (which is only built once per activity),
context menus are discarded once they are used or dismissed.
•To find out when a context menu choice was chosen,
implement onContextItemSelected() on the activity.
Example 1: Using Option and Context Menu
Selection Widgets
Selection Widgets
Radio Buttons and Check Buttons are suitable for selecting
from a smallset of options.
When the pool of choices is larger other widgets are more
appropriate, those include classic UI controls such as: list
boxes, combo boxes, drop-down lists, picture galleries, etc.
Android offers a framework of data adapters that provide a
common interface to selection lists ranging from static arrays to
database contents.
Selection views –widgets for presenting lists of choices –are
handed an adapter to supply the actual choices.
Displaying/Selecting Options
Using Array Adapter
 The easiest adapter to use is ArrayAdapter–all you need to do is wrap one of these
around a Java array or java.util.List instance, and you have a fully functioning
adapter:
The Array Adapter constructor takes three parameters:
1.The Context to use (typically this will be your activity instance)
2.The resource ID of a view to use (such as the built-in system resource
android.R.layout.simple_list_item_1as shown above)
3.The actual (source) array or list of items to show
Example 1: A simple list
Instead of Activity we will use a ListActivity which is an Android class specializing in
the use of ListViews.
Example 1: A simple list (Activity)
Instead of Activity we will use a ListActivity which is an Android class specializing in
the use of ListViews.
Example 1: A simple list (Adapter)
Example 1: A simple list (out put)
Selection Widgets - Spin Control
In Android, the Spinner is the equivalent of the drop-down
selector.
Spinners have the same functionality of a ListView but take
less space.
As with ListView, you provide the adapter for linking data to
child views using setAdapter()
Add a listener object to capture selections made from the list
with setOnItemSelectedListener().
Use the setDropDownViewResource()method to supply
the resource ID of the multi-line selection list view to use.
Example - Using the Spinner (Demo)
Example - Using the Spinner (Xml Layout)
Example - Using the Spinner (Activity)
Example - Using the Spinner (Events)
Selection Widgets - GridView
GridView is a ViewGroup that displays items in a two-dimensional, scrollable
grid.
The grid items are automatically inserted to the layout using a ListAdapter.
Example . Grid View (Xml Layout)
Example . Grid View (Activity)
Example . Grid View (Events)
Selection Widgets - AutoCompleteTextView
With auto-completion, as the user types, the text is treated as
a prefix filter, comparing the entered text as a prefix against a
list of candidates.
Matches are shown in a selection list that, like with Spinner, folds
down from the field.
The user can either type out a new entry (e.g., something not in
the list) or choose an entry from the list to be the value of the field.
AutoCompleteTextView subclasses EditText, so you can configure
all the standard look-and-feel aspects, such as font face and color.
AutoCompleteTextView has a
android:completionThresholdproperty, to indicate the
minimum number of characters a user must enter before the
list filtering begins.
Example . Auto Complete TextView
Example . AutoCompleteTextView (Xml layout)
Example . Auto Complete TextView (Activity)
Example . AutoCompleteTextView (Events)
Selection Widgets - Gallery Widget
The Gallery widget provides a set of options depicted as images.
Image choices are offered on a contiguous horizontal mode, you
may scroll across the image-set.
Example - Gallery Widget (XML Layout)
Example - Gallery Widget (Activity)
Example - Gallery Widget (Events)
Example - Gallery Widget (Adapter)
Example - Gallery Widget (Adapter - cont)
Example - Gallery Widget (Adapter - cont)
Example - Gallery Widget (Adapter - cont)
Questions?

Weitere ähnliche Inhalte

Was ist angesagt?

Model builder in ARC GIS
Model builder in ARC GISModel builder in ARC GIS
Model builder in ARC GISKU Leuven
 
Model View Controller
Model View ControllerModel View Controller
Model View ControllerSV.CO
 
Alv report-tutorial-www.sapexpert.co .uk-
Alv report-tutorial-www.sapexpert.co .uk-Alv report-tutorial-www.sapexpert.co .uk-
Alv report-tutorial-www.sapexpert.co .uk-Faina Fridman
 
Access Database Manager fro Mac
Access Database Manager fro MacAccess Database Manager fro Mac
Access Database Manager fro MacJohn Li
 
How to use a spreadsheet
How to use a spreadsheetHow to use a spreadsheet
How to use a spreadsheetSwarnima Tiwari
 

Was ist angesagt? (7)

Multiselect list
Multiselect listMultiselect list
Multiselect list
 
Model builder in ARC GIS
Model builder in ARC GISModel builder in ARC GIS
Model builder in ARC GIS
 
Model View Controller
Model View ControllerModel View Controller
Model View Controller
 
Alv report-tutorial-www.sapexpert.co .uk-
Alv report-tutorial-www.sapexpert.co .uk-Alv report-tutorial-www.sapexpert.co .uk-
Alv report-tutorial-www.sapexpert.co .uk-
 
Access Database Manager fro Mac
Access Database Manager fro MacAccess Database Manager fro Mac
Access Database Manager fro Mac
 
Lecture6 oopj
Lecture6 oopjLecture6 oopj
Lecture6 oopj
 
How to use a spreadsheet
How to use a spreadsheetHow to use a spreadsheet
How to use a spreadsheet
 

Andere mochten auch

Experience protocol buffer on android
Experience protocol buffer on androidExperience protocol buffer on android
Experience protocol buffer on androidRichard Chang
 
The Android graphics path, in depth
The Android graphics path, in depthThe Android graphics path, in depth
The Android graphics path, in depthChris Simmonds
 
GPU, CUDA, OpenCL and OpenACC for Parallel Applications
GPU, CUDA, OpenCL and OpenACC for Parallel ApplicationsGPU, CUDA, OpenCL and OpenACC for Parallel Applications
GPU, CUDA, OpenCL and OpenACC for Parallel ApplicationsMarcos Gonzalez
 
Lec11 semaphores
Lec11 semaphoresLec11 semaphores
Lec11 semaphoresanandammca
 
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveAndroid graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveBin Chen
 
Graphics processing unit (GPU)
Graphics processing unit (GPU)Graphics processing unit (GPU)
Graphics processing unit (GPU)Amal R
 
Graphics processing unit ppt
Graphics processing unit pptGraphics processing unit ppt
Graphics processing unit pptSandeep Singh
 
What is CPU Register? Type of CPU Register.
What is CPU Register? Type of CPU Register.What is CPU Register? Type of CPU Register.
What is CPU Register? Type of CPU Register.Kapil Dev Das
 
Internal and external business environment
Internal and external business environmentInternal and external business environment
Internal and external business environmentAashish Sahi
 

Andere mochten auch (13)

Android gui framework
Android gui frameworkAndroid gui framework
Android gui framework
 
Experience protocol buffer on android
Experience protocol buffer on androidExperience protocol buffer on android
Experience protocol buffer on android
 
The Android graphics path, in depth
The Android graphics path, in depthThe Android graphics path, in depth
The Android graphics path, in depth
 
GPU, CUDA, OpenCL and OpenACC for Parallel Applications
GPU, CUDA, OpenCL and OpenACC for Parallel ApplicationsGPU, CUDA, OpenCL and OpenACC for Parallel Applications
GPU, CUDA, OpenCL and OpenACC for Parallel Applications
 
Lec11 semaphores
Lec11 semaphoresLec11 semaphores
Lec11 semaphores
 
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveAndroid graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
 
Graphics processing unit (GPU)
Graphics processing unit (GPU)Graphics processing unit (GPU)
Graphics processing unit (GPU)
 
Graphics processing unit ppt
Graphics processing unit pptGraphics processing unit ppt
Graphics processing unit ppt
 
Android IPC Mechanism
Android IPC MechanismAndroid IPC Mechanism
Android IPC Mechanism
 
What is CPU Register? Type of CPU Register.
What is CPU Register? Type of CPU Register.What is CPU Register? Type of CPU Register.
What is CPU Register? Type of CPU Register.
 
Design and Concepts of Android Graphics
Design and Concepts of Android GraphicsDesign and Concepts of Android Graphics
Design and Concepts of Android Graphics
 
Internal and external business environment
Internal and external business environmentInternal and external business environment
Internal and external business environment
 
Slideshare ppt
Slideshare pptSlideshare ppt
Slideshare ppt
 

Ähnlich wie 01 10 - graphical user interface - others

Ähnlich wie 01 10 - graphical user interface - others (20)

Android menus in android-chapter15
Android menus in android-chapter15Android menus in android-chapter15
Android menus in android-chapter15
 
Android interface elements and controls-chapter8
Android interface elements and controls-chapter8Android interface elements and controls-chapter8
Android interface elements and controls-chapter8
 
"Android" mobilių programėlių kūrimo įvadas #2
"Android" mobilių programėlių kūrimo įvadas #2"Android" mobilių programėlių kūrimo įvadas #2
"Android" mobilių programėlių kūrimo įvadas #2
 
Maliram poonia project
Maliram poonia projectMaliram poonia project
Maliram poonia project
 
Day 4: Android: UI Widgets
Day 4: Android: UI WidgetsDay 4: Android: UI Widgets
Day 4: Android: UI Widgets
 
Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]Day 5: Android User Interface [View Widgets]
Day 5: Android User Interface [View Widgets]
 
Ajp notes-chapter-01
Ajp notes-chapter-01Ajp notes-chapter-01
Ajp notes-chapter-01
 
java
javajava
java
 
Android UI Fundamentals part 1
Android UI Fundamentals part 1Android UI Fundamentals part 1
Android UI Fundamentals part 1
 
Ajp notes-chapter-01
Ajp notes-chapter-01Ajp notes-chapter-01
Ajp notes-chapter-01
 
Swing jecrc
Swing jecrc Swing jecrc
Swing jecrc
 
AWT information
AWT informationAWT information
AWT information
 
List Views
List ViewsList Views
List Views
 
Lesson 9
Lesson 9Lesson 9
Lesson 9
 
Basic controls in asp
Basic controls in aspBasic controls in asp
Basic controls in asp
 
Windows Programming with AWT
Windows Programming with AWTWindows Programming with AWT
Windows Programming with AWT
 
Chapter 6
Chapter 6Chapter 6
Chapter 6
 
GUI components in Java
GUI components in JavaGUI components in Java
GUI components in Java
 
Building a simple user interface lesson2
Building a simple user interface lesson2Building a simple user interface lesson2
Building a simple user interface lesson2
 
Android session 3
Android session 3Android session 3
Android session 3
 

Mehr von Siva Kumar reddy Vasipally

Mehr von Siva Kumar reddy Vasipally (10)

01 11 - graphical user interface - fonts-web-tab
01  11 - graphical user interface - fonts-web-tab01  11 - graphical user interface - fonts-web-tab
01 11 - graphical user interface - fonts-web-tab
 
01 09 - graphical user interface - basic widgets
01  09 - graphical user interface - basic widgets01  09 - graphical user interface - basic widgets
01 09 - graphical user interface - basic widgets
 
01 08 - graphical user interface - layouts
01  08 - graphical user interface - layouts01  08 - graphical user interface - layouts
01 08 - graphical user interface - layouts
 
01 07 -android programming basics (cont)
01  07 -android programming basics (cont)01  07 -android programming basics (cont)
01 07 -android programming basics (cont)
 
01 06 - android programming basics
01  06 - android programming basics01  06 - android programming basics
01 06 - android programming basics
 
01 05 - introduction xml
01  05 - introduction xml01  05 - introduction xml
01 05 - introduction xml
 
01 04 - android set up and creating an android project
01  04 - android set up and creating an android project01  04 - android set up and creating an android project
01 04 - android set up and creating an android project
 
01 03 - introduction to android
01  03 - introduction to android01  03 - introduction to android
01 03 - introduction to android
 
01 02 - introduction - adroid stack
01  02 - introduction - adroid stack01  02 - introduction - adroid stack
01 02 - introduction - adroid stack
 
01 01 - introduction to mobile application development
01  01 - introduction to mobile application development01  01 - introduction to mobile application development
01 01 - introduction to mobile application development
 

Kürzlich hochgeladen

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 

Kürzlich hochgeladen (20)

Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

01 10 - graphical user interface - others

  • 2. Agenda Familiarize with the main types of GUI components Layouts Basic Widgets Others
  • 4. Using Menus Menus is not consuming ‘much’ view space. Android provides two types of menu known as: options menu and context menu.  The options menu is triggered by pressing the hardware Menu button on the device, while  The context menu is raised by a tap-and-hold on the widget associated to the menu.
  • 5. Using Menus Example: Using an option menu Options available in this context Press Menu Button A max of six entries per menu. Excess will be displayed as part of the More option
  • 6. Example: Using an option menu Available Options in this context Press Menu button Using Menus
  • 7. Example : Dealing with SMS (text-messages) by using the built- in Messaging app’s context menu Tap-&-Hold Using Menus
  • 8. Option and Context Menus may include: 1. Text 2. Icons 3. Radio Buttons 4. Check Boxes 5. Sub-menus 6. Short-cut keys
  • 12. Example 1: Using Option and Context Menu The app shows two text boxes. Menus are used to change text’s size, color, and style.
  • 13. Example 1: Using Option and Context Menu The app shows two text boxes. Menus are used to change text’s size, color, and style.
  • 14. Example 1: Using Option and Context Menu The app shows two text boxes. Menus are used to change text’s size, color, and style.
  • 15. Example 1: Using Option and Context Menu
  • 16. Example 1: Using Option and Context Menu
  • 17. Example 1: Using Option and Context Menu
  • 18. Example 1: Using Option and Context Menu
  • 19. Comments on Creating an Option & Context Menu Step1. Indicate which widget(s) on your activity have context menus. To do this, call registerForContextMenu(theWidget) supplying the View that is the widget needing a context menu. Step2. Implement onCreateContextMenu(…), populate your menu adding text, icons, etc. to the different options.Use input menu parameter to determine which menu to build (assuming your activity has more than one). The onCreateContextMenu()method gets the Context Menu itself, the View the context menu is associated with, and a ContextMenu. ContextMenuInfo, which tells you which item in the list the user did the tap-and-hold over, in case you want to customize the context menu based on that information
  • 20. Comments on Creating an Option & Context Menu •onCreateContextMenu() is called each time the context menu is requested. •Unlike the options menu (which is only built once per activity), context menus are discarded once they are used or dismissed. •To find out when a context menu choice was chosen, implement onContextItemSelected() on the activity.
  • 21. Example 1: Using Option and Context Menu
  • 23. Selection Widgets Radio Buttons and Check Buttons are suitable for selecting from a smallset of options. When the pool of choices is larger other widgets are more appropriate, those include classic UI controls such as: list boxes, combo boxes, drop-down lists, picture galleries, etc. Android offers a framework of data adapters that provide a common interface to selection lists ranging from static arrays to database contents. Selection views –widgets for presenting lists of choices –are handed an adapter to supply the actual choices.
  • 25. Using Array Adapter  The easiest adapter to use is ArrayAdapter–all you need to do is wrap one of these around a Java array or java.util.List instance, and you have a fully functioning adapter: The Array Adapter constructor takes three parameters: 1.The Context to use (typically this will be your activity instance) 2.The resource ID of a view to use (such as the built-in system resource android.R.layout.simple_list_item_1as shown above) 3.The actual (source) array or list of items to show
  • 26. Example 1: A simple list Instead of Activity we will use a ListActivity which is an Android class specializing in the use of ListViews.
  • 27. Example 1: A simple list (Activity) Instead of Activity we will use a ListActivity which is an Android class specializing in the use of ListViews.
  • 28. Example 1: A simple list (Adapter)
  • 29. Example 1: A simple list (out put)
  • 30. Selection Widgets - Spin Control In Android, the Spinner is the equivalent of the drop-down selector. Spinners have the same functionality of a ListView but take less space. As with ListView, you provide the adapter for linking data to child views using setAdapter() Add a listener object to capture selections made from the list with setOnItemSelectedListener(). Use the setDropDownViewResource()method to supply the resource ID of the multi-line selection list view to use.
  • 31. Example - Using the Spinner (Demo)
  • 32. Example - Using the Spinner (Xml Layout)
  • 33. Example - Using the Spinner (Activity)
  • 34. Example - Using the Spinner (Events)
  • 35. Selection Widgets - GridView GridView is a ViewGroup that displays items in a two-dimensional, scrollable grid. The grid items are automatically inserted to the layout using a ListAdapter.
  • 36. Example . Grid View (Xml Layout)
  • 37. Example . Grid View (Activity)
  • 38. Example . Grid View (Events)
  • 39. Selection Widgets - AutoCompleteTextView With auto-completion, as the user types, the text is treated as a prefix filter, comparing the entered text as a prefix against a list of candidates. Matches are shown in a selection list that, like with Spinner, folds down from the field. The user can either type out a new entry (e.g., something not in the list) or choose an entry from the list to be the value of the field. AutoCompleteTextView subclasses EditText, so you can configure all the standard look-and-feel aspects, such as font face and color. AutoCompleteTextView has a android:completionThresholdproperty, to indicate the minimum number of characters a user must enter before the list filtering begins.
  • 40. Example . Auto Complete TextView
  • 42. Example . Auto Complete TextView (Activity)
  • 44. Selection Widgets - Gallery Widget The Gallery widget provides a set of options depicted as images. Image choices are offered on a contiguous horizontal mode, you may scroll across the image-set.
  • 45. Example - Gallery Widget (XML Layout)
  • 46. Example - Gallery Widget (Activity)
  • 47. Example - Gallery Widget (Events)
  • 48. Example - Gallery Widget (Adapter)
  • 49. Example - Gallery Widget (Adapter - cont)
  • 50. Example - Gallery Widget (Adapter - cont)
  • 51. Example - Gallery Widget (Adapter - cont)