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

美食电子商务网站建设规划书成都网站建设哪家专业而且比较便宜

美食电子商务网站建设规划书,成都网站建设哪家专业而且比较便宜,自己制作网站该怎么做,公民道德建设网站近期在做新项目中接触到了Preference#xff0c;这是一种用户界面元素#xff0c;用于存储和展示应用程序的各种设置和用户偏好。该控件几年前google就已经发布了只是一直没机会应用#xff0c;其实用起来还是挺方便的#xff0c;使用过程中遇到了几个问题在此记录下。 1、… 近期在做新项目中接触到了Preference这是一种用户界面元素用于存储和展示应用程序的各种设置和用户偏好。该控件几年前google就已经发布了只是一直没机会应用其实用起来还是挺方便的使用过程中遇到了几个问题在此记录下。 1、自定义Preference在屏幕显示时宽度没有充满屏幕 constructor(context: Context,attrs: AttributeSet?,defStyleAttr: Int,defStyleRes: Int) : super(context, attrs, defStyleAttr) {//主要是这个点需要调用setLayoutResource而不是setWidgetLayoutResourcelayoutResource R.layout.preference_icon_title_layoutval config context.obtainStyledAttributes(attrs,R.styleable.IconTitlePreference,defStyleAttr,defStyleRes)//获取属性mTitle config.getString(R.styleable.IconTitlePreference_settingTitle)config.recycle()}2、release包打开Preference相关页面出现闪退 Preferenceapp:fragmentaaa.bbb.ccc.fragment.DemoFragmentapp:titlestring/settings_adblock /如果在xml你通过fragment属性配置了跳转页面的话闪退问题是混淆导致的最好是将fragment属性指定的fragment放到同一个文件夹下然后配置整个目录不被混淆 -keep class aaa.bbb.ccc.fragment.**{*;}3、顶部返回按钮回退处理 通常我们在父Activity里实现PreferenceFragmentCompat.OnPreferenceStartFragmentCallback来监听onPreferenceStartFragment回调然后获取要打开的fragment添加到布局中 override fun onPreferenceStartFragment(caller: PreferenceFragmentCompat,pref: Preference): Boolean {val args pref.extrasval fragment supportFragmentManager.fragmentFactory.instantiate(classLoader,pref.fragment!!)fragment.arguments argsfragment.setTargetFragment(caller, 0)supportFragmentManager.beginTransaction()//可以在这里设置fragment启动动画.setCustomAnimations(R.anim.slide_in_from_right,R.anim.fade_out_scale,R.anim.fade_in_scale,R.anim.slide_out_to_right).replace(R.id.root, fragment)//这个方法一定要调用为了将当前fragment添加到回退栈中用于下面的popBackStackImmediate调用.addToBackStack(null).commit()return true}顶部title的返回键处理 findViewByIdImageView(R.id.setting_page_title).setOnClickListener {//如果直接finish的话无论你fragment层级有多深都会全部关闭//popBackStackImmediate从回退栈中弹出当前fragment弹出成功会返回true//如果是到达了父容器层级时会返回false这时候直接finish即可if (!supportFragmentManager.popBackStackImmediate()) {finish()}}最后总结下自定义Preference的使用 class SuperPreference : Preference {private var mTitle : String?private lateinit var mIconIv : ImageViewconstructor(context: Context) : this(context, null)constructor(context: Context, attrs: AttributeSet?) : this(context,attrs,R.attr.preferenceStyle)constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : this(context,attrs,defStyleAttr,0)constructor(context: Context,attrs: AttributeSet?,defStyleAttr: Int,defStyleRes: Int) : super(context, attrs, defStyleAttr) {//替换布局layoutResource R.layout.preference_icon_title_layoutval config context.obtainStyledAttributes(attrs,//自定义的属性R.styleable.IconTitlePreference,defStyleAttr,defStyleRes)//获取属性mTitle config.getString(R.styleable.IconTitlePreference_settingTitle)config.recycle()}override fun onBindViewHolder(holder: PreferenceViewHolder) {super.onBindViewHolder(holder)//在这里对控件的findViewById初始化操作mIconIv holder.findViewById(R.id.setting_icon) as ImageView//对控件进行赋值等操作} }
http://www.hkea.cn/news/14433921/

相关文章:

  • 开发一个网站的步骤流程大型网站怎么做优化
  • 无锡网络公司可以制作网站WordPress用quic
  • 成都专业网站建设价格店面设计师岗位职责
  • 网站建设工作量评估渭南建设工程招标投标网站
  • 网站建设后台有哪些项目怎么区分营销型和展示型的网站
  • 上海企业建站提供商学校网站怎么下载不了
  • 网站建设的基础内容公司网站开发主要技术
  • 网站被同行链接代替自媒体十大平台
  • 北京网站优化解决方案北京专门做网站的公司
  • 车公庙网站建设免费网站在哪里申请
  • 山东省建设教育集团网站首页汕头快速建站模板
  • 网站图片如何做链接重庆品牌餐饮加盟网站建设
  • 站长工具推荐seo综合查询网站编程入门教程
  • 网站做支付链接安全吗免费微信公众号首图
  • 上海专业网站建设公司一个平台维护三天正常吗
  • 做网站吉林去哪儿网站上做民宿需要材料
  • 上海有名的做网站的公司有哪些常州的网站建设
  • 网站不备案会怎...wordpress 支持手机6
  • 网站收录软件设计网站项目描述
  • 替朋友做网站wordpress get_post_custom_values
  • 完整酒店网站开发网站制作com cn域名有什么区别
  • 微信电影网站怎么做的福田网站建设论文结论
  • 网站网页设计htmlseo百度推广
  • 建网站怎么赚流量网页网站的区别是什么
  • 大连网站建设开发网站建设与推广培训学校
  • 镇江做网站网站开发遇到的问题
  • 网站如何进行网络推广福州网站怎么做的
  • seo网站推广建站服务商买网站服务器
  • 淄博网站制作优化专业建设网站技术
  • 用dw做简单图片网站wordpress注册登录