1 / 38

Widgets & Other Views - Part 1

Widgets & Other Views - Part 1. Frank Xu Gannon University. Date Picker. Main.xml. onClickListener -button. A dialog is always created and displayed as a part of an  Activity . You should normally create dialogs from within your Activity's  onCreateDialog ( int )  callback method.

gerard
Download Presentation

Widgets & Other Views - Part 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Widgets & Other Views-Part 1 Frank Xu Gannon University

  2. Date Picker

  3. Main.xml

  4. onClickListener -button

  5. A dialog is always created and displayed as a part of an Activity. You should normally create dialogs from within your Activity's onCreateDialog(int) callback method.

  6. This is an Activity callback method that is passed the integer ID given to showDialog(int) (which is called by the button's View.OnClickListener). When the ID matches the switch case defined here, a DatePickerDialog is instantiated with the DatePickerDialog.OnDateSetListener created in the previous step, along with the date variables to initialize the widget date

  7. Hello TimePicker

  8. main.xml • Start a new project named HelloTimePicker. • Open the res/layout/main.xml file and insert the following:

  9. When the user is done setting the time (clicks the "Set" button), the onTimeSet() method is called and it updates the member fields with the new time and updates the layout's TextView

  10. Hello FormStuff

  11. Custom Button- android_button.xml • Copy the images on the right into the res/drawable/ directory of your project. These will be used for the different button states. • Create a new file in the res/drawable/ directory named android_button.xml. Insert the following XML: XML file that defines three different images to use for the different button states Note: The order of the <item> elements is important. When this drawable is referenced, the <item>s are traversed in-order to determine which one is appropriate for the current button state. Because the "normal" image is last, it is only applied when the conditions android:state_pressedandandroid:state_focused have both evaluated false.

  12. Custom Button -UI • Copy the images on the right into the res/drawable/ directory of your project. These will be used for the different button states. • Create a new file in the res/drawable/ directory named android_button.xml. Insert the following XML: android_button.xml • This replaces the normal background image used for buttons throughout the system. In order for the drawable to change its image based on the button state, the image must be applied to the background.

  13. Checkbox

  14. Edit Text

  15. Radio Buttons

  16. Toggle Button -alternative to radio buttons 

  17. Rating Bar

More Related