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

营销网站模板wordpress qq邮箱留言

营销网站模板,wordpress qq邮箱留言,域名买好后怎么建设网站,网站 色调近期在做新项目中接触到了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/14287673/

相关文章:

  • 买奢侈品代工厂做的产品的网站名怎么申请免费企业邮箱账号
  • 网站响应式技术wordpress 主页不显示图片
  • 怎么查网站是谁建的盐山县网站建设
  • 怎么黑进网站后台工程建设分为哪几个阶段
  • 个人如何制作网站长沙投资公司排名
  • 企业网站开发模板下载百度搜索不到网站
  • 成都展示型网站开发怎么样创建微信公众号
  • 网站建设方案书写专门制作网站
  • 哈尔滨网站建设方案策划石景山老山网站建设
  • 搭建网站的流程温州网站建设和推广
  • 学习软件有哪些宁波网站搜索优化
  • 浙江品牌网站设计专家php网站 缓存
  • wordpress建站比较建设网站的价值
  • 合肥做网站行吗码支付wordpress用不
  • 网站建设是什么部门wordpress 首页设置幻灯片
  • 辽宁住房建设厅网站wordpress在哪儿设置关键词和描述
  • 免费word模板网站163企业邮箱注册怎么注册
  • 网站二级页面设计个体户做网站有用吗
  • 网站报价单模板电子商务网站怎么备案
  • 网站如何备案icp备案一份完整的品牌策划方案
  • 做外贸建网站视频网站系统开发
  • 我想做网站怎么做网站logo设计教程
  • 专业的网站建设哪家快wordpress 微信登录插件下载
  • 甘肃建网站互联网营销师怎么考
  • 公司理念网站餐厅网站页面设计
  • 网站和网页的区别百度网站是怎么建设的
  • 做二手货的网站有哪些为什么自己做的网站打开是乱码
  • 北京朝阳网站嘉兴房产网站建设
  • 小型网站维护商田科技网站
  • 网站建设 每年收费个人dw网页设计