Wednesday, 24 June 2015

How to create AnalogClock and DigitalClock in Android.

Analogclock and Digitalclock views 

* The AnalogClock view displays an analog clock with two hands — one for minutes and one for hours.

* Its counterpart, the DigitalClock view, displays the time digitally. Both display the system time, and do not allow you to display a particular time.

* Hence, if you want to display the time for a particular region, you have to build your own custom views.

Using the AnalogClock and DigitalClock views are straightforward; simply declare them in your XML file (such as main.xml), like this:

<?xml ​version=”1.0”​encoding=”utf-8”?>
<LinearLayout ​xmlns:android=”” ​​​​android:orientation=”vertical”
​​​​android:layout_height=”fill_parent” ​​​​>

<AnalogClock ​​
​​android:layout_width=”wrap_content” ​​
​​android:layout_height=”wrap_content” />

​​​​android:layout_width=”wrap_content” ​​
​​android:layout_height=”wrap_content” />


No comments:

Post a Comment