AndroidGUI10:DigitalClock和AnalogClock的常用技巧
2011-05-12 18:13
330 查看
绝大部分情况下,不需要使用者两个控件。即使要使用它们,也几乎无需针对它们进行编程。
1.
在布局文件
(main.xml)
中,增加界面元素声明如下:
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
LinearLayout
xmlns:android
=
"http://schemas.android.com/apk/res/android"
android:orientation
=
"vertical"
android:layout_width
=
"fill_parent"
android:layout_height
=
"fill_parent"
android:gravity
=
"center_horizontal"
>
<
DigitalClock
android:id
=
"@+id/digital_clock"
android:layout_width
=
"wrap_content"
android:layout_height
=
"wrap_content"
/>
<
AnalogClock
android:id
=
"@+id/analog_clock"
android:layout_width
=
"wrap_content"
android:layout_height
=
"wrap_content"
/>
</
LinearLayout
>
运行结果
:
1.
在布局文件
(main.xml)
中,增加界面元素声明如下:
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
LinearLayout
xmlns:android
=
"http://schemas.android.com/apk/res/android"
android:orientation
=
"vertical"
android:layout_width
=
"fill_parent"
android:layout_height
=
"fill_parent"
android:gravity
=
"center_horizontal"
>
<
DigitalClock
android:id
=
"@+id/digital_clock"
android:layout_width
=
"wrap_content"
android:layout_height
=
"wrap_content"
/>
<
AnalogClock
android:id
=
"@+id/analog_clock"
android:layout_width
=
"wrap_content"
android:layout_height
=
"wrap_content"
/>
</
LinearLayout
>
运行结果
:
![](http://hi.csdn.net/attachment/201105/12/0_1305195214G75i.gif)
相关文章推荐
- android开发 常用技巧
- Android系统常用Makefile技巧
- (一)Android ViewTreeObserver的常用技巧
- AndroidGUI03:Spinner的常用技巧
- Android之编译打包apk时几个常用的技巧
- Android编程规范与常用技巧
- AndroidGUI15:Style常用技巧
- 大话Android项目中的常用技巧
- android中常用的技巧
- Android 常用编程技巧
- AndroidGUI03:Spinner的常用技巧
- Android之编译打包apk时几个常用的技巧
- Android_编程规范与常用技巧
- ANDROID编程规范与常用技巧
- 【android】编程规范、常用技巧和性能优化
- Android&nbsp;emulator常用指令与技巧
- AndroidGUI04:Button(Basic Button,ImageButton, Check Box, Toggle Button, Radio Button)的常用技巧
- AndroidGUI08:RatingBar的常用技巧
- AndroidGUI04:Button(Basic Button,ImageButton, Check Box, Toggle Button, Radio Button)的常用技巧
- 微信小程序开发常用技巧(7)——实现一个类似于Android toast效果动画