Tablayout 选项卡图标未显示在真实设备上,而是显示在模拟器上

问题描述

我遇到的问题是,我的 tablayout condition1 ? yes : (condition2 ? yes : (condition3 ? yes : no)) 没有显示在我的真实设备(三星 galaxy s7)上,但在模拟器上一切正常。

模拟器

enter image description here

真实设备

enter image description here

片段表格布局

tab.icons

布局xml

private fun initimageView() {
    shopItembinding.productimageViewpager.adapter = shopItemImageViewPager.apply { submitList(productArgs.product.images) }
    
    TabLayoutMediator(shopItembinding.shopItemTablayout,shopItembinding.productimageViewpager) { tab,_ ->
            when {
                productArgs.product.images.size > 1 -> tab.icon = ContextCompat.getDrawable(
                    requireContext(),R.drawable.shop_item_tab_unselected // this is the drawable for the dots
                )
                else -> shopItembinding.shopItemTablayout.visibility = View.GONE // deleting this made no difference
            }
        }.attach()
    }

看起来视图没有消失,因为模拟器和真实设备的高度保持不变

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)