ivHomeTabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener { override fun onTabSelected(p0: TabLayout.Tab?) { // TODO("Not yet implemented") updatePaperHeight(fragmentList[p0!!.position].view) } override fun onTabUnselected(p0: TabLayout.Tab?) { // TODO("Not yet implemented") } override fun onTabReselected(p0: TabLayout.Tab?) { // TODO("Not yet implemented") } }) homeViewPager.viewTreeObserver.addOnGlobalLayoutListener { updatePaperHeight(fragmentList[homeViewPager.currentItem].view) }
viewpage,fragment,viewpaper自适应,ViewPager切换高度自适应
ViewPager的高度根据item的高度自适应
来源:https://blog.csdn.net/qq_37159335/article/details/122825035