当前位置: 首页 > news >正文

朝阳区手机网站建设服务网站和微网站

朝阳区手机网站建设服务,网站和微网站,坚持,做网站如何在开发应用程序的过程中我们有很大的机会需要用到参数设置功能#xff0c;那么在Android应用中#xff0c;我们如何实现参数设置界面及参数存储呢#xff0c;下面我们来介绍一下Android中的一个特殊Activity–PreferencesActivity。PreferencesActivity是Android中专门用来实…在开发应用程序的过程中我们有很大的机会需要用到参数设置功能那么在Android应用中我们如何实现参数设置界面及参数存储呢下面我们来介绍一下Android中的一个特殊Activity–PreferencesActivity。PreferencesActivity是Android中专门用来实现程序设置界面及参数存储的一个Activity我们用一个实例来简介如何使用PreferencesActivity。 通过查看SDK自带的ApiDemo可以发现里面有一个类叫PreferenceActivity里面的第一个例子是通过xml文件来实现的其它的还没研究首先通过Eclipse把ApiDemo安装到手机上然后从手机上打开选择第一个App大概在第二页的样子就有一个Preferences点进去就有了稍微整理了一下发出来。。。 按照惯例还是先发图看看效果如果不是你们所要的效果也不浪费你们的时间 效果图就是这样了现在就开始码代码吧。。。 注意这个界面并非传统的layout布局格式 在res目录下面新建一个文件夹xml然后在里面新建文件preferences.xml ?xml version1.0 encodingutf-8? PreferenceScreen xmlns:androidhttp://schemas.android.com/apk/res/android PreferenceCategory android:titlestring/inline_preferences CheckBoxPreferenceandroid:keycheckbox_preferenceandroid:summarystring/summary_toggle_preferenceandroid:titlestring/title_toggle_preference //PreferenceCategoryPreferenceCategory android:titlestring/dialog_based_preferences EditTextPreferenceandroid:dialogTitlestring/dialog_title_edittext_preferenceandroid:keyedittext_preferenceandroid:summarystring/summary_edittext_preferenceandroid:titlestring/title_edittext_preference /ListPreferenceandroid:dialogTitlestring/dialog_title_list_preferenceandroid:entriesarray/entries_list_preferenceandroid:entryValuesarray/entryvalues_list_preferenceandroid:keylist_preferenceandroid:summarystring/summary_list_preferenceandroid:titlestring/title_list_preference //PreferenceCategoryPreferenceCategory android:titlestring/launch_preferences PreferenceScreenandroid:keyscreen_preferenceandroid:summarystring/summary_screen_preferenceandroid:titlestring/title_screen_preference CheckBoxPreferenceandroid:keynext_screen_checkbox_preferenceandroid:summarystring/summary_next_screen_toggle_preferenceandroid:titlestring/title_next_screen_toggle_preference //PreferenceScreenPreferenceScreenandroid:summarystring/summary_intent_preferenceandroid:titlestring/title_intent_preference intentandroid:actionandroid.intent.action.VIEWandroid:datahttp://www.baidu.com //PreferenceScreen/PreferenceCategoryPreferenceCategory android:titlestring/preference_attributes CheckBoxPreferenceandroid:keyparent_checkbox_preferenceandroid:summarystring/summary_parent_preferenceandroid:titlestring/title_parent_preference /CheckBoxPreferenceandroid:dependencyparent_checkbox_preferenceandroid:keychild_checkbox_preferenceandroid:layout?android:attr/preferenceLayoutChildandroid:summarystring/summary_child_preferenceandroid:titlestring/title_child_preference //PreferenceCategory /PreferenceScreen 当然里面用到了一些字符串定义在Strings.xml文件里面的 ?xml version1.0 encodingutf-8? resourcesstring nameaction_settingsSettings/stringstring namehelloHello World, MainActivity!/stringstring nameapp_namePreferences_Demo/stringstring nameinline_preferencesIn-line preferences/stringstring nametitle_toggle_preferenceToggle preference/stringstring namesummary_toggle_preferenceThis is a toggle button/stringstring namedialog_based_preferencesDialog-based preferences/stringstring nametitle_edittext_preferenceEdit text preference/stringstring namedialog_title_edittext_preferenceEnter your favorite animal/stringstring namesummary_edittext_preferenceAn example that uses an edit text dialog/stringstring nametitle_list_preferenceList preference/stringstring namesummary_list_preferenceAn example that uses a list dialog/stringstring namepreference_attributesPreference attributes/stringstring nametitle_parent_preferenceParent toggle/stringstring namesummary_parent_preferenceThis is visually a parent/stringstring nametitle_child_preferenceChild toggle/stringstring namesummary_child_preferenceThis is visually a child/stringstring nametitle_next_screen_toggle_preferenceToggle preference/stringstring namesummary_next_screen_toggle_preferencePreference that is on the next screen but same hierarchy/stringstring nametitle_intent_preferenceIntent preference/stringstring namesummary_intent_preferenceLaunches an Activity from an Intent/stringstring nametitle_screen_preferenceScreen preference/stringstring namesummary_screen_preferenceShows another screen of preferences/stringstring namedialog_title_list_preferenceChoose one/stringstring namelaunch_preferencesLaunch preferences/string /resources还有两个array数组在values文件夹下面建一个arrays.xml ?xml version1.0 encodingutf-8? resourcesstring-array nameentries_list_preferenceitemAlpha Option 01/itemitemBeta Option 02/itemitemCharlie Option 03/item/string-arraystring-array nameentryvalues_list_preferenceitemalpha/itemitembeta/itemitemcharlie/item/string-array /resourcesOK下面写主类MainActivity它继承自PreferenceActivity package com.and.preferences;import android.os.Bundle; import android.preference.PreferenceActivity;public class MainActivity extends PreferenceActivity {/** Called when the activity is first created. */Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);addPreferencesFromResource(R.xml.preferences);} }行了ApiDemo里面好像还提供几种有待于研究。。。。 原文传送门http://www.cnblogs.com/and_he/archive/2012/01/06/2315088.html 相关文章 Android中Preference的使用以及监听事件分析http://blog.csdn.net/qinjuning/article/details/6710003 Android 中Preferences的使用http://blog.csdn.net/android_tutor/article/details/5531849
http://www.hkea.cn/news/14306690/

相关文章:

  • 上海seo网站优化_搜索引擎排名_优化型企业网站建设_锦鱼网络医院网站设计方案
  • 音乐中文网站模板盗版小说网站怎么做
  • 永州网站建设收费情况wordpress数据库连接错误
  • asp.net空网站广州番禺邮政编码
  • 重庆梁平网站建设哪家好织梦仿站建站网站建设实战
  • 青岛快速网站排名网络推广有哪些形式
  • 商城网站如何建设网址站
  • 阿里云网站如何建设厦门 网站设计
  • 网站飘窗建设合同安徽省工程建设工程信息网站
  • 龙岗网站建设代理商仿牌外贸网站制作
  • 常州个人网站设计网站做排名
  • 定制家具网站平台现在流行用什么语言做网站
  • 描述一下网站建设的基本流程图seo外链是什么意思
  • 网站app软件企事业网站建设
  • 自己编程怎么做网站教程企业局域网视频网站建设
  • 做网站郴州全屏网站设计
  • google建设网站赚钱网店美工素材
  • 会展网站的建设情况怎样编辑网页
  • 网站开发语音占比网站首页域名如何设置访问快
  • 山东建设和城乡建设厅注册中心网站韩国购物网站有哪些
  • 浙江新东阳建设集团有限公司网站dw怎样做网站切换
  • 零售客户电商网站delphi做网站开发
  • 中山好的做网站的公司心雨在线高端网站建设网页设计
  • 珠海营销型网站福田企业网站优化方案
  • 网站建设进度表 下载wordpress data
  • 网站开发与应用 论文长沙建网站企业
  • 网站外链接自己可以怎么做饮料招商网站大全
  • 手机网站开发方案360网站卫士代备案流程
  • 电商网站如何备案大气自适应网站源码
  • 东莞市长安镇做网站wordpress友情链接单页