Closed zpliang94 closed 2 years ago
我估计是你ViewBinding绑定的布局被layout
标签包裹了, 即你用ViewBinding去绑定DataBinding
布局文件导致的问题
但是Demo我没发现此操作, 是否是你自己修改了demo?
Duplicate of #181
我估计是你ViewBinding绑定的布局被
layout
标签包裹了, 即你用ViewBinding去绑定DataBinding
布局文件导致的问题但是Demo我没发现此操作, 是否是你自己修改了demo?
在fragment页面上加了
这属于viewBinding基础问题, 我不清楚什么叫fragment页面加了, 如果还有问题请fork仓库复现问题, 我猜不出来你的操作
在fragment 的布局文件上加了 layout 标签包裹了linearlayout
在fragment 的布局文件上加了 layout 标签包裹了linearlayout
ViewBinding不允许出现layout
, 因为这是DataBinding才使用的
java.lang.RuntimeException: view must have a tag at com.drake.brv.sample.DataBinderMapperImpl.getDataBinder(DataBinderMapperImpl.java:625) at androidx.databinding.MergedDataBinderMapper.getDataBinder(MergedDataBinderMapper.java:74) at androidx.databinding.DataBindingUtil.bind(DataBindingUtil.java:199) at androidx.databinding.ViewDataBinding.bind(ViewDataBinding.java:695) at com.drake.brv.sample.databinding.ItemSimpleBinding.bind(ItemSimpleBinding.java:83) at com.drake.brv.sample.databinding.ItemSimpleBinding.bind(ItemSimpleBinding.java:71) at com.drake.brv.sample.ui.fragment.ViewBindingFragment$onViewCreated$1$1.invoke(ViewBindingFragment.kt:26) at com.drake.brv.sample.ui.fragment.ViewBindingFragment$onViewCreated$1$1.invoke(ViewBindingFragment.kt:25) at com.drake.brv.BindingAdapter$BindingViewHolder.bind$brv_debug(BindingAdapter.kt:1144) at com.drake.brv.BindingAdapter.onBindViewHolder(BindingAdapter.kt:182) at com.drake.brv.BindingAdapter.onBindViewHolder(BindingAdapter.kt:70) at androidx.recyclerview.widget.RecyclerView$Adapter.onBindViewHolder(RecyclerView.java:7254) at com.drake.brv.BindingAdapter.onBindViewHolder(BindingAdapter.kt:193) at com.drake.brv.BindingAdapter.onBindViewHolder(BindingAdapter.kt:70) at androidx.recyclerview.widget.RecyclerView$Adapter.bindViewHolder(RecyclerView.java:7337) at androidx.recyclerview.widget.RecyclerView$Recycler.tryBindViewHolderByDeadline(RecyclerView.java:6194) at androidx.recyclerview.widget.RecyclerView$Recycler.tryGetViewHolderForPositionByDeadline(RecyclerView.java:6460) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6300) at androidx.recyclerview.widget.RecyclerView$Recycler.getViewForPosition(RecyclerView.java:6296) at androidx.recyclerview.widget.LinearLayoutManager$LayoutState.next(LinearLayoutManager.java:2330) at androidx.recyclerview.widget.LinearLayoutManager.layoutChunk(LinearLayoutManager.java:1631) at androidx.recyclerview.widget.LinearLayoutManager.fill(LinearLayoutManager.java:1591) at androidx.recyclerview.widget.LinearLayoutManager.onLayoutChildren(LinearLayoutManager.java:668) at com.drake.brv.layoutmanager.HoverLinearLayoutManager.onLayoutChildren(HoverLinearLayoutManager.java:207) at androidx.recyclerview.widget.RecyclerView.dispatchLayoutStep2(RecyclerView.java:4309) at androidx.recyclerview.widget.RecyclerView.dispatchLayout(RecyclerView.java:4012) at androidx.recyclerview.widget.RecyclerView.onLayout(RecyclerView.java:4578) at android.view.View.layout(View.java:22496) at android.view.ViewGroup.layout(ViewGroup.java:6528) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1857) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1701) at android.widget.LinearLayout.onLayout(LinearLayout.java:1610) at android.view.View.layout(View.java:22496) at android.view.ViewGroup.layout(ViewGroup.java:6528) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:334) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:22496) at android.view.ViewGroup.layout(ViewGroup.java:6528) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1857) at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1701) at android.widget.LinearLayout.onLayout(LinearLayout.java:1610) at android.view.View.layout(View.java:22496) at android.view.ViewGroup.layout(ViewGroup.java:6528) at androidx.drawerlayout.widget.DrawerLayout.onLayout(DrawerLayout.java:1263) at android.view.View.layout(View.java:22496) at android.view.ViewGroup.layout(ViewGroup.java:6528) at android.widget.FrameLayout.layoutChildren(FrameLayout.java:334) at android.widget.FrameLayout.onLayout(FrameLayout.java:270) at android.view.View.layout(View.java:22496) at android.view.ViewGroup.layout(ViewGroup.java:6528) at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1857)
版本