Thursday 15 November 2012

Drag & drop elements in Time & Date




Today we are discussing about the drag & drop elements in TIME & DATE.The TIME& DATE elements in ANDROID are given bellow.




Pickers


  • Android provides time and date picker for choosing the time and date in the android applications.
  • The user can set time and date by using this two pickers.

  • Time picker provides control for selecting each part of time  such as hour,minute and AM or PM.
  • The default code is given bellow.
        <TimePicker
        android:id="@+id/timePicker1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
     />



  • Date picker provides control for selecting month,day and year.
  • The default code is given bellow.
         <DatePicker
        android:id="@+id/datePicker1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
     />




Chronometer


  • Chronometer class that shows a simple timer. 
  • The default code is given bellow.

      <Chronometer
        android:id="@+id/chronometer1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Chronometer" 
      />


Analog Clock

  • This widget in Time & Date shows an analog clock with 2 hands for hours and minutes.
  • The default code is given bellow.
    <AnalogClock
        android:id="@+id/analogClock1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
    />


Digital Clock

  • This widget show time in hours,minute and seconds in digital form
  • The default code is given bellow.
    <DigitalClock
        android:id="@+id/digitalClock1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="DigitalClock"
    />
  

1 comments:

Anonymous said...

Please make sure to add example for the date and time picker.