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

深圳微商城网站制作联系电话自己做网站 怎样下载模板

深圳微商城网站制作联系电话,自己做网站 怎样下载模板,贵阳网站建设服务公司,网站设计的硬件一、效果图 选中#xff1a;显示自动更新开启不选择#xff1a;显示自动更新关闭------------在布局文件中的使用方式和android自生的控件一样 ?xml version1.0 encodingutf-8? LinearLayout xmlns:androidhttp://schemas.andro…一、效果图 选中显示自动更新开启不选择显示自动更新关闭------------在布局文件中的使用方式和android自生的控件一样 ?xml version1.0 encodingutf-8? LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidxmlns:zengmghttp://schemas.android.com/apk/res/com.zengmg.MobileSafeandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:orientationvertical TextViewstylestyle/ActivityTitleandroid:textstring/settingTitle /com.zengmg.MobileSafe.view.SettingItemViewandroid:idid/siv_updateandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentzengmg:desc_off自动更新关闭zengmg:desc_on自动更新开启zengmg:title自动更新设置 //LinearLayout 二、步骤 思路模仿android定义好的控件来写1、写好布局文件2、编写自定义 attrs.xml3、编写自定义控件代码4、在activity中使用增加点击事件代码三、各步骤代码 控件名SettingItemView3.1布局文件activity_setting.xml ?xml version1.0 encodingutf-8? LinearLayout xmlns:androidhttp://schemas.android.com/apk/res/androidxmlns:zengmghttp://schemas.android.com/apk/res/com.zengmg.MobileSafeandroid:layout_widthmatch_parentandroid:layout_heightmatch_parentandroid:orientationvertical TextViewstylestyle/ActivityTitleandroid:textstring/settingTitle /com.zengmg.MobileSafe.view.SettingItemViewandroid:idid/siv_updateandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentzengmg:desc_off自动更新关闭zengmg:desc_on自动更新开启zengmg:title自动更新设置 //LinearLayout 注意需要加入一个自定义的xml声明xmlns:zengmghttp://schemas.android.com/apk/res/com.zengmg.MobileSafe 声明中的 zengmg 是配置属性时的头。 zengmg:desc_off自动更新关闭 zengmg:desc_on自动更新开启 zengmg:title自动更新设置 3.2 自定义 attrs.xml?xml version1.0 encodingutf-8? resourcesdeclare-styleable nameSettingItemViewattr nametitle formatstring /attr namedesc_on formatstring /attr namedesc_off formatstring //declare-styleable!-- 在D:\ADT\sdk\platforms\android-16\data\res\values\attrs.xml 文件中找 nameTextView。nameSettingItemView 是控件名--/resources 3.3 自定义控件代码 SettingItemView.javapackage com.zengmg.MobileSafe.view;import com.zengmg.MobileSafe.R;import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.widget.CheckBox; import android.widget.RelativeLayout; import android.widget.TextView;/*** 设置页面的自定义控件* 布局文件在view_setting_item.xml* 属性文件在values/attrs.xml。通过查看Android自带的控件找到的* * author zengmg* */ public class SettingItemView extends RelativeLayout {private static final String NAMESPACE http://schemas.android.com/apk/res/com.zengmg.MobileSafe;private TextView tvTitle;private TextView tvDesc;private CheckBox cbState;private String mtitle;private String mDescOn;private String mDescOff;public SettingItemView(Context context, AttributeSet attrs, int defStyle) {super(context, attrs, defStyle);}public SettingItemView(Context context, AttributeSet attrs) {super(context, attrs);mtitleattrs.getAttributeValue(NAMESPACE, title);mDescOnattrs.getAttributeValue(NAMESPACE, desc_on);mDescOffattrs.getAttributeValue(NAMESPACE, desc_off);initView();}public SettingItemView(Context context) {super(context);}public void initView(){//View android.view.View.inflate(Context context, int resource, ViewGroup root)//将自定义好的布局文件设置给当前的SettingItemView控件//当SettingItemView控件被使用时文件view_setting_item里的布局就被显示了View.inflate(getContext(), R.layout.view_setting_item, this);tvTitle(TextView) findViewById(R.id.tv_title);tvDesc(TextView) findViewById(R.id.tv_desc);cbState(CheckBox) findViewById(R.id.cb_status);setMtitle(mtitle);}public String getMtitle() {return tvTitle.getText().toString();}public void setMtitle(String mtitle) {tvTitle.setText(mtitle);}public String getmDescOn() {return tvDesc.getText().toString();}public void setmDescOn(String mDescOn) {tvDesc.setText(mDescOn);}public String getmDescOff() {return tvDesc.getText().toString();}public void setmDescOff(String mDescOff) {tvDesc.setText(mDescOff);}public boolean isChecked() {return cbState.isChecked();}public void setChecked(boolean mIsChecked) {cbState.setChecked(mIsChecked);if(mIsChecked){tvDesc.setText(mDescOn);}else{tvDesc.setText(mDescOff);}}}有关View.inflate(getContext(), R.layout.view_setting_item, this);参见http://blog.csdn.net/zengmingen/article/details/49975753 3.4 在activity使用的代码 package com.zengmg.MobileSafe.activity;import android.app.Activity; import android.content.SharedPreferences; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener;import com.zengmg.MobileSafe.R; import com.zengmg.MobileSafe.view.SettingItemView;public class SettingActivity extends Activity{private SettingItemView sivUpdate;private SharedPreferences mPref;Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_setting);mPref getSharedPreferences(config, MODE_PRIVATE);sivUpdate(SettingItemView) findViewById(R.id.siv_update);boolean autoUpdatemPref.getBoolean(auto_update, true);sivUpdate.setChecked(autoUpdate);sivUpdate.setOnClickListener(new OnClickListener() {Overridepublic void onClick(View v) {if(sivUpdate.isChecked()){//不自动更新sivUpdate.setChecked(false);mPref.edit().putBoolean(auto_update, false).commit();}else{//自动更新sivUpdate.setChecked(true);mPref.edit().putBoolean(auto_update, true).commit();}}});} }
http://www.pierceye.com/news/44740/

相关文章:

  • 昆明凡科建站公司凡客官网旗舰店
  • 网站建设制作费用友链互换平台推荐
  • 做团购网站哪家好些网站访客记录
  • 金诺网站建设wordpress插件云采集
  • 啊宝贝才几天没做网站河北怀来县建设局网站
  • 太原便宜做网站的公司哪家好深圳做网站
  • 刚建的网站百度搜不到如何构建一个电子商务网站
  • 邢台专业网站建设价格怎样申请微信小程序卖货
  • 阳泉网站建设哪家便宜快手刷赞网站推广软件
  • 如何让自己的网站排在前面企业网站建完后没人
  • 哪家建公司网站中国电商平台排行榜前十
  • 网站开发更新记录wordpress 固定链接 404
  • 网站建设开发熊掌号抖音生活服务旅行社ota入驻
  • 织梦可以做英文网站吗中小型互联网企业有哪些
  • wordpress仿qq临沂网站优化
  • 如何做营销型单页网站帝国怎么做网站
  • 如何用代码做分数查询的网站去哪里做网站安全等级保护级别
  • 横琴建设局网站生产系统管理软件
  • 百度站长平台申请提交链接学院网站开发网站定位
  • 南昌网站关键词排名网站式登录页面模板下载地址
  • 南宁百度网站建设公司软件it网站建设方案
  • 河南网站seowordpress cia易验证
  • 重庆本地建站巴中区建设局网站
  • 自己做的网站怎么添加采集模块软件设计师培训机构
  • 昆明做网站建设的公司易语言如何做代刷网站
  • h5网站价格小制作灯笼简单又漂亮
  • 莱芜公交网站omv wordpress
  • 上海网站排名seo公司哪家好找人做网站域名怎么过户
  • 大学网站建设管理办法wordpress中国最好主题
  • 网站seo视频想在自己的网站做支付