widgets other views part 1
Download
Skip this Video
Download Presentation
Widgets & Other Views - Part 1

Loading in 2 Seconds...

play fullscreen
1 / 38

Widgets & Other Views - Part 1 - PowerPoint PPT Presentation


  • 67 Views
  • Uploaded on

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.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Widgets & Other Views - Part 1' - gerard


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

slide7
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.
slide8
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
main xml1
main.xml
  • Start a new project named HelloTimePicker.
  • Open the res/layout/main.xml file and insert the following:
slide13
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
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  elements is important. When this drawable is referenced, the 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.
toggle button

Toggle Button

-alternative to radio buttons 

ad