Wednesday, August 15, 2012

Android AnalogClock

Android AnalogClock
This widget display an analogic clock with two hands for hours and minutes.  
 a) Anlogclock
Like AnalogClock, but digital. Shows seconds. FIXME: implement separate views for hours/minutes/seconds, so proportional fonts don't shake rendering 
 b) Digitalclock
Analogclock example 
main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <AnalogClock android:id="@+id/content"
         android:background="#D0A0A0"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent" />
</RelativeLayout>

Digital clock and AnalogClock
this code analog clokc and digital clock
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  >
  <AnalogClock android:id="@+id/analogclk"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_alignParentTop="true"
    />
  <DigitalClock android:id="@+id/digitalclk"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerHorizontal="true"
    android:layout_below="@id/analogclk"
    />
</RelativeLayout>
Activity code

/**

*

* @author vijayakumar

*

*/

public class AndroidMADQAActivity extends Activity {

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.main);

}

No comments:

Post a Comment

Check out this may be help you

Related Posts Plugin for WordPress, Blogger...