Blankj / AndroidUtilCode

:fire: Android developers should collect the following utils(updating).
https://blankj.com/2016/07/31/android-utils-code/
Apache License 2.0
33.25k stars 10.67k forks source link

使用ToastUtils 之后刷新列表的时候会造成列表不正常显示,有时还会崩溃 在华为手机上 型号EVA-AL00 #704

Closed xiangyao0906 closed 5 years ago

xiangyao0906 commented 5 years ago

<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical">

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <com.scwang.smartrefresh.layout.SmartRefreshLayout
        android:id="@+id/farm_refresh"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <LinearLayout

            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:orientation="vertical">

            <LinearLayout
                android:id="@+id/noCropLayout"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:background="@color/background"
                android:gravity="center"
                android:orientation="vertical">

                <ImageView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:background="@drawable/empty_page" />

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="暂未找到未绑定的作物" />
            </LinearLayout>

            <LinearLayout
                android:id="@+id/cropLayout"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:visibility="gone">

                <android.support.v7.widget.RecyclerView
                    android:id="@+id/choose_crop_list"
                    android:layout_width="match_parent"
                    android:layout_height="match_parent" />
            </LinearLayout>
        </LinearLayout>

    </com.scwang.smartrefresh.layout.SmartRefreshLayout>

    <LinearLayout
        android:id="@+id/sure_to_add_crop"
        android:layout_width="match_parent"
        android:layout_height="70dp"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginBottom="15dp"
        android:gravity="center"
        android:visibility="gone">

        <ImageView
            android:id="@+id/connaconCropToDikuai"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@mipmap/tjzw_sure_btn_copy" />

    </LinearLayout>

</RelativeLayout>

Blankj commented 5 years ago

你只用了 ToastUtils 吗,还是还用了什么

chenxi2035 commented 5 years ago

我在商米平板上也遇到了,导致展示异常。内存资源丢失。应该是与修改了density有关,使用默认Toast实现就正常了。建议增加开关,可以绕过与显示Toast无关的操作。

xiangyao0906 commented 5 years ago

你只用了 ToastUtils 吗,还是还用了什么

沒有,我是整体引入的。只是在用toast的时候 发现了一些奇怪的问题,报错就像 @candyguy242 说的那样,报错是资源文件丢失。还有就是用了今日头条的适配方案,确实是修改了density。

chenxi2035 commented 5 years ago

我没有用那些适配方案,直接调用的ToastUitls的方法,设置了居中等等,也出现了兼容性问题。其他设备上没有遇到。

Blankj commented 5 years ago

你们过两天用我最新的适配方案吧,我会把过去适配方案删掉

Blankj commented 5 years ago

升级到 1.22.0 试试

chenxi2035 commented 5 years ago

商米平板新版已验证通过~