安卓闹钟界面 [英] Android Alarm Clock UI
问题描述
我想弄清楚用户界面是如何为 Android 闹钟应用设计的.这似乎使用了 Holo Dark 主题.
I am trying to figure out how the UI was designed for the Android Alarm Clock app. This appears to be using the Holo Dark Theme.
包含的屏幕截图是创建/编辑警报 Activity
屏幕.它看起来类似于 Android 设置.是这种情况吗?因为打开闹钟"&振动"行看起来像 ChexboxPreferences
.铃声"行看起来像一个 RingtonePreference
.时间"行呢?
The screenshot included is the Create/Edit Alarm Activity
screen. It looks similar to Android Settings. Is this case? Because the "Turn the alarm on" & "Vibrate" rows look like ChexboxPreferences
. The "Ringtone" row looks like a RingtonePreference
. What about the "Time" row?
正如@eric 在对以下答案之一的评论中提到的那样,我正在尝试重新创建与闹钟应用程序类似的界面.我不想发送意图从我的应用程序启动警报管理器.
As @eric mentioned in the comments to one of the answers below, I am trying to recreate a similar interface to the alarm clock app. I do not want to send an intent to start the Alarm Manager from my app.
标签"行呢?它的功能很像 EditText
视图.你可以在 PreferenceScreen
xml 标签中组合 Views
和 Preferences
吗?
What about the "Label" row? That functions a lot like an EditText
view. Can you have a combination of Views
and Preferences
inside a PreferenceScreen
xml tag?
还有 ActionBar
有一个垂直管道,我不确定它是如何创建的,但是完成"视图是 ImageButton
吗?
Also the ActionBar
has a vertical pipe, I am not sure how this was created but is the "Done" view an ImageButton
?
我并不完全相信它是首选项的组合,因为闹钟应用程序可以有多个闹钟,而不仅仅是一个闹钟.如果有多个警报并且您不使用多个 SharedPreferences
文件,那么创建一个内容提供程序来存储与多个警报相关的信息自然是有意义的.
I am not completely convinced that it is a combination of Preferences, since the Alarm app can have multiple alarms and not just one alarm. If there are multiple alarms and you don't use multiple SharedPreferences
files, it would naturally make sense to create a content provider to store the information related to multiple alarms.
推荐答案
股票闹钟应用开源,所以自己检查一下.
The stock alarm clock app is open source, so check it out by yourself.
首选项布局请参见此处:/p>
Preference Layout see here:
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
android:title="@string/set_alarm">
<CheckBoxPreference android:key="on"
android:title="@string/enable"/>
<Preference android:key="time"
android:title="@string/time"/>
<com.android.alarmclock.AlarmPreference
android:key="alarm"
android:title="@string/alert"
android:ringtoneType="alarm"
android:showDefault="false"
android:showSilent="false" />
<CheckBoxPreference android:key="vibrate"
android:title="@string/alarm_vibrate"/>
<com.android.alarmclock.RepeatPreference
android:key="setRepeat"
android:title="@string/alarm_repeat" />
<EditTextPreference android:key="label"
android:title="@string/label"
android:dialogTitle="@string/label" />
</PreferenceScreen>
Preference activity see here, note that, the links I referenced are not from the head revision.
一些亮点:
- Time 是一个简单的
android.preference.Preference
,由TimePickerDialog
支持. Ringtone
是android.preference.RingtonePreference
的自定义实现.- Repeat 是
android.preference.ListPreferenc
e 的自定义实现. - 警报由静态类com.android 管理.alarmclock.Alarms 使用内容提供程序存储实际信息.
- 从 Android 4.0 开始默认使用 Holo 主题,在其他 Android 版本上,您可能会看到不同的主题.请注意,不同的 android 版本或设备供应商也可能会更改应用程序实现.
- Time is a plain
android.preference.Preference
, backed byTimePickerDialog
. Ringtone
is a customized implementation ofandroid.preference.RingtonePreference
.- Repeat is a customized implementation of
android.preference.ListPreferenc
e. - Alarms are managed by a static class com.android.alarmclock.Alarms which use Content Providers store the actual information.
- Holo theme is used by default since Android 4.0, on other Android version, you may see different theme. Note that the app implementation may also changed by different android version or device vendor.
这篇关于安卓闹钟界面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!