This widget display an analogic clock with two hands for
hours and minutes.
Code -
<AnalogClock
android:id="@+id/hk_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
android:id="@+id/hk_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
Java
LinearLayout layout1=(LinearLayout)findViewById(R.id.ll1); AnalogClock analogClock=new AnalogClock(this); analogClock.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT)); layout1.addView(analogClock);
android:dial
Android:dial attribute is use to add background or dial.
Dial means not call dialer but it's watch dial.
Code - android:dial="@drawable/signin"
android:hand_hour
Replace the hour default image of clock with your own image.
code - android:hand_hour="@drawable/h_bg"
android:hand_minute
Replace the minute default image of clock with your own image.
Code - android:hand_hour="@drawable/m_bg"
Program
-1
<AnalogClock android:id="@+id/hk_time" android:layout_width="wrap_content" android:layout_height="wrap_content" android:dial="@drawable/signin" android:hand_hour="@drawable/h_bg" android:hand_minute="@drawable/m_bg" />
No comments:
Post a Comment