DslTabLayout 点击事件
YQcharlse opened this issue · 13 comments
YQcharlse commented
先是添加了所有item,然后动态的隐藏 GONE个别 item ,这时 item 的索引就会改变 怎样在点击事件时获取 之前没有隐藏时的 索引
angcyo commented
动态Gone Item
之后, 请调用com.angcyo.tablayout.DslTabLayout#updateTabLayout
方法
YQcharlse commented
这样的话item索引也是会改变, 我想要的是item占位在索引上,索引不改变 这样的情况应该怎么做呢
angcyo commented
view.setTag
自行保存
YQcharlse commented
嗯嗯好的那我知道了谢谢
YQcharlse commented
老哥,是否可以设置选中的view
angcyo commented
setCurrentItem
YQcharlse commented
我的意思是直接指定view
angcyo commented
通过View
查找对应的Index
, 然后setCurrenItem
YQcharlse commented
老哥怎么查找呀,没有找到方法呀
angcyo commented
getChildAt()
YQcharlse commented
哥,没明白呀,这个方法不是通过 index 查找 view吗?
angcyo commented
tabLayout.forEachIndexed { index, view ->
if (view == xxx) {
return index
}
}
YQcharlse commented
哦哦谢谢老哥麻烦了,太感谢了