【Settings】去除使用GPS提供时间的选项

来源:互联网 发布:网络直播盈利模式 编辑:程序博客网 时间:2024/06/14 21:00

Settings的主界面在Settings.java中继承SettingsActivity
这里写图片描述
日期与时间的activity为DateTimeSettingsActivity继承自SettingsActivity

在日期与时间中的自动确定日期与时间的选项中,用到ListPreference
Android首选项框架ListPreference
在res/xml/date_time_prefs.xml中

<SwitchPreference android:key="auto_time"        android:title="@string/date_time_auto"        android:summaryOn="@string/date_time_auto_summaryOn"        android:summaryOff="@string/date_time_auto_summaryOff"/>

这个选项卡中选定自动选择日期和时间的方式
在DateTimeSettings中的initUI()中可以看到
这里写图片描述
就是手机中 自动确定日期与时间的选项卡
这里写图片描述
这里写图片描述
根据GPS_SUPPORT的值来判断KEY_AUTO_TIME_LIST的值为“auto_time_list”还是“auto_time_list_no_gps”
查找KEY_AUTO_TIME_LIST在代码中的位置
这里写图片描述
相应操作
为了显示没有gps的界面,将GPS_SUPPORT的值设置为false即可。
public static boolean GPS_SUPPORT = false;

push 路径system/priv-app/Settings

0 0
原创粉丝点击