Книга: Beginning Android
Time Keeps Flowing Like a River
Time Keeps Flowing Like a River
If you want to display the time, rather than have users enter the time, you may wish to use the DigitalClock
or AnalogClock
widgets. These are extremely easy to use, as they automatically update with the passage of time. All you need to do is put them in your layout and let them do their thing.
For example, from the Fancy/Clocks
sample application, here is an XML layout containing both DigitalClock
and AnalogClock
:
<?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/analog"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_alignParentTop="true"
/>
<DigitalClock android:id="@+id/digital"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_below="@id/analog"
/>
</RelativeLayout>
Without any Java code other than the generated stub, we can build this project (see Figure 10-4).
Figure 10-4. The ClocksDemo sample application
- CHAPTER 10 Employing Fancy Widgets and Containers
- Ограничение времени ожидания для транзакций (Lock timeout)
- JDBC Туре 4 DRIVER
- DEADLOCK TIMEOUT
- CONNECTION TIMEOUT
- Timestamp request
- Chapter 2 Building and Deploying a Run-Time Image
- DiskExplorer от Runtime Software
- Test Driver Code
- Time2Post
- B10. Функции даты и времени: ‹time.h›
- 11.7 Soft Timers and Timer Related Operations