图层列表可绘制不时不完全呈现

问题描述

我遇到了一个问题,即我的图层列表可绘制对象不时无法完全呈现。

在我的活动的 onCreate 中,我以编程方式创建了几个 TextView,在 onResume 中,我正在调用 Web 服务,并在收到响应后相应地更新此 TextView。

   TextView tv = getView().findViewWithTag(tag);

    if ((int) wt.getCustomerId() == Const.CUSTOMER_xxx) {

        tv.setBackgroundResource(R.drawable.tile_sended_xxx);

    } else {

        switch ((int) wt.getActivityId()) {

            case Const.ACTIVITY_WALK:
                tv.setBackgroundResource(R.drawable.tile_sended_walk);
                break;
            case Const.ACTIVITY_AUTO:
                tv.setBackgroundResource(R.drawable.tile_sended_auto);
                break;
            default:
                tv.setBackgroundResource(R.drawable.tile_sended_work);
                break;
        }
    }

还有我的一个可绘制对象(蓝色背景、咖啡图标):

<item>
    <shape
        android:padding="0dp"
        android:shape="rectangle">

        <solid android:color="@color/tile_sended_xxx"/>

        <corners
            android:bottomLeftRadius="4dp"
            android:bottomRightRadius="4dp"
            android:topLeftRadius="4dp"
            android:topRightRadius="4dp"/>

    </shape>

</item>

<item
    android:drawable="@drawable/coffee"
    android:gravity="center">
</item>

问题是有时只渲染背景(黄色/蓝色),但看不到图标。

它发生在不同的模拟器中,它发生在真实设备上。

我不知道如何调试/解决这个问题。任何帮助将不胜感激。

我还添加了一些屏幕来表明 Android Studio 显示正常。

enter image description here

enter image description here

解决方法

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

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

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