hackware1993 / MagicIndicator

A powerful, customizable and extensible ViewPager indicator framework. As the best alternative of ViewPagerIndicator, TabLayout and PagerSlidingTabStrip —— 强大、可定制、易扩展的 ViewPager 指示器框架。是ViewPagerIndicator、TabLayout、PagerSlidingTabStrip的最佳替代品。支持角标,更支持在非ViewPager场景下使用(使用hide()、show()切换Fragment或使用setVisibility切换FrameLayout里的View等),http://www.jianshu.com/p/f3022211821c
9.68k stars 1.54k forks source link

1.7.0 MagicIndicator 与viewpager2联用不能点击 #282

Closed wuh876 closed 2 years ago

wuh876 commented 2 years ago

1.7.0 MagicIndicator 与viewpager2联用不能点击

Lans commented 1 year ago

老哥,咋解决的

wuh876 commented 1 year ago

需要给titleview设置点击

Lans commented 1 year ago

override fun getTitleView(context: Context?, index: Int): IPagerTitleView { return CommonPagerTitleView(requireContext()) .apply { // TODO: 标题设置 text = "test" setNormalColor(ColorUtils.getColor(R.color.base_colorGray)) setSelectedColor(ColorUtils.getColor(R.color.base_colorWhite)) setSelectedBackground(R.drawable.shape_round_select) setNormalBackground(R.drawable.shape_round_normal) setNormalSize(16) setSelectedSize(16) setOnClickListener { toast("哈哈$index") } } } 好像也不起作用😅

wuh876 commented 1 year ago

不弹toast吗?

Lans commented 1 year ago

没反应的

wuh876 commented 1 year ago

不会吧,点击事件都没了?

Lans commented 1 year ago

我写的有问题,fragment盖在上面了😂,解决了呢

发自Lans

在 2023年3月10日,17:42,wuh876 @.***> 写道:

 不会吧,点击事件都没了?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.