微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

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

如何解决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 举报,一经查实,本站将立刻删除。