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

云虚拟主机怎么建网站wordpress小兽

云虚拟主机怎么建网站,wordpress小兽,贵阳有专业的翻译机构吗,seo优化网站教程高版本的gradle不再支持 kotlin-android-extensions插件#xff0c;因此view的绑定方式也有所改变。 1.启用视图绑定 android {...viewBinding {enabled true}} 如果想在生成绑定类时忽略某个布局文件#xff0c;请将 tools:viewBindingIgnoretrue 属性添加到…高版本的gradle不再支持 kotlin-android-extensions插件因此view的绑定方式也有所改变。 1.启用视图绑定 android {...viewBinding {enabled true}} 如果想在生成绑定类时忽略某个布局文件请将 tools:viewBindingIgnoretrue 属性添加到相应布局文件的根视图中 LinearLayout...tools:viewBindingIgnoretrue ... /LinearLayout 2.在 Activity 中使用视图绑定 如需设置绑定类的实例以供 Activity 使用请在 Activity 的 onCreate() 方法中执行以下步骤 调用生成的绑定类中包含的静态 inflate() 方法。此操作会创建该绑定类的实例以供 Activity 使用。通过调用 getRoot() 方法或使用 Kotlin 属性语法获取对根视图的引用。将根视图传递到 setContentView()使其成为屏幕上的活动视图。 private lateinit var binding: ResultProfileBindingoverride fun onCreate(savedInstanceState: Bundle) {super.onCreate(savedInstanceState)binding ResultProfileBinding.inflate(layoutInflater)val view binding.rootsetContentView(view)} 3.在 Fragment中使用视图绑定 如需设置绑定类的实例以供 Fragment 使用请在 Fragment 的 onCreateView() 方法中执行以下步骤 调用生成的绑定类中包含的静态 inflate() 方法。此操作会创建该绑定类的实例以供 Fragment 使用。通过调用 getRoot() 方法或使用 Kotlin 属性语法获取对根视图的引用。从 onCreateView() 方法返回根视图使其成为屏幕上的活动视图。 private var _binding: ResultProfileBinding? nullprivate val binding get() _binding!!override fun onCreateView(inflater: LayoutInflater,container: ViewGroup?,savedInstanceState: Bundle?): View? {_binding ResultProfileBinding.inflate(inflater, container, false)return binding.root}override fun onDestroyView() {super.onDestroyView()_binding null} 4.自定义Dialog中使用 public class MyDialog extends Dialog {protected View mView;protected DialogBottomBinding mBinding;public MyDialog(NonNull Context context, StyleRes int themeResId) {super(context, themeResId);//原来的写法// mView View.inflate(getContext(), getLayoutId(), null);//使用ViewBinding的写法mBinding DialogBottomBinding.inflate(getLayoutInflater());mView mBinding.getRoot();setContentView(mView);} } 5.在自定义View中使用 // 自定义view public class MyLinearLayout extends LinearLayout {public MyLinearLayout(Context context) {this(context, null);}public MyLinearLayout(Context context, Nullable AttributeSet attrs) {this(context, attrs, 0);}public MyLinearLayout(Context context, Nullable AttributeSet attrs, int defStyleAttr) {super(context, attrs, defStyleAttr);// 正常添加布局亲测有效ViewMyLayoutBinding binding LibPlateformLayoutBinding.inflate(LayoutInflater.from(getContext()), this, true);// 方法二// val root View.inflate(context, R.layout.widget_core, this)// binding WidgetCoreBinding.bind(root)// 针对根标签为mergeViewMyLayoutMergeBinding binding ViewMyLayoutMergeBinding.inflate(LayoutInflater.from(getContext()), this);}} 6.在RecyclerView的Adapter中使用 class StudentAdapter(private val context: Context,private val list: ListAddressInfo) : RecyclerView.AdapterItemViewHolder() {override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ItemViewHolder {val studentBinding ItemAddressBinding.inflate(LayoutInflater.from(context), parent, false)return ItemViewHolder(studentBinding)}SuppressLint(SetTextI18n)override fun onBindViewHolder(holder: ItemViewHolder, position: Int) {holder.itemBinding.tvName.text 姓名 list[position].name}override fun getItemCount(): Int {return list.size}inner class ItemViewHolder(var itemBinding: ItemAddressBinding) : RecyclerView.ViewHolder(itemBinding.root) } 以上是各场景使用viewBinding的方式基本可以满足大家的开发需求如有其他场景的可以在评论区留言讨论。
http://www.hkea.cn/news/14347806/

相关文章:

  • 可以做网站的编程有什么WordPress源码带会员中心系统
  • 怎么修改公司网站图片宁波网站推广合作商
  • 黑龙江省建设教育网站查询站长工具seo推广
  • 做智能网站系统长沙景点排行榜前十名
  • 需要证书的建筑公司网站wordpress描述怎么改
  • 简洁汽车配件网站模板网站代码如何导入
  • 排名好的网站建设企业建设网站的风险分析
  • 做贵网站多少钱陕西住房和城乡建设厅官网
  • 德庆网站建设网站时间显示
  • 泉州有哪些做网站的客源汇软件怎么样
  • 保险网站有哪些情感网站seo
  • 什么网站可以做装修效果图的企业主页图片
  • 网站建设与管理实践报告总结网站名申请
  • 门户网站建设专业dede后台做两个网站
  • 切管机维修 东莞网站建设小程序游戏怎么开发
  • 网站打不开显示asp空气炸锅做糕点的网站
  • 给别人做网站赚钱吗京东金融
  • 老薛主机wordpress模板wordpress 搜索引擎优化
  • 网站开速度 流失网页设计师个人网站
  • 自己怎么做商城网站视频教程中国建筑网官网查询系统
  • 织梦dedecms医院类网站在线预约挂号插件_utf8表白网
  • 网站助手 伪静态中国航空集团有限公司
  • cms与php做网站的区别信阳网
  • 设计网站推荐素材网站网站开发 协作平台
  • 欧莱雅网站建设与推广方案洛阳青峰做网站
  • 外贸营销网站推广建设比较好网站
  • 玉林做绿化苗木网站的是哪个单位宿迁司法拍卖房产网
  • 黄渡网站建设跑步机 东莞网站建设
  • 上市公司数据查询网站什么网站可以自己接工程做预算
  • 做网站需要做数据库有没有专门做采购的网站