Widgets other views part 1
This presentation is the property of its rightful owner.
Sponsored Links
1 / 38

Widgets & Other Views - Part 1 PowerPoint PPT Presentation


  • 55 Views
  • Uploaded on
  • Presentation posted in: General

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.

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Widgets other views part 1

Widgets & Other Views-Part 1

Frank Xu

Gannon University


Date picker

Date Picker


Main xml

Main.xml


Onclicklistener button

onClickListener -button


Widgets other views part 1

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.


Widgets other views part 1

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


Hello timepicker

Hello TimePicker


Main xml1

main.xml

  • Start a new project named HelloTimePicker.

  • Open the res/layout/main.xml file and insert the following:


Widgets other views part 1

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


Hello formstuff

Hello FormStuff


Custom button android button xml

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.


Custom button ui

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.


Checkbox

Checkbox


Edit text

Edit Text


Radio buttons

Radio Buttons


Toggle button

Toggle Button

-alternative to radio buttons 


Rating bar

Rating Bar


  • Login