GridView 无法显示图像 [英] GridView cannot show image

查看:41
本文介绍了GridView 无法显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我获取了所有应用程序的图标,并在 GridView 中显示这些图标.GridView 很好地显示了它们,但是当我非常快速地向下滑动 GridView 时,有时在 GridView 上缺少两个图标.这种情况不常出现,能不能给点建议.

I get all application's icons, and show the icons in GridView. The GridView shows them very well, but when I glides the GridView very fast to downward, sometimes lack of two icons at GridView. This kind of situation not often appears, can you give me some advice.

这个问题以前有人问过,但没有答案.Android 中的 GridView 滚动问题

EDIT : this question have been asked before, but no answers. Scrolling issues with GridView in Android

推荐答案

我已经解决了,在我的情况下,我在GridView的适配器中使用这些XML来显示图像和文本:

I have solved it, in my situation, in the adapter of GridView that I used these XML to show image and text:

<!--  <LinearLayout android:layout_width="fill_parent"  android:layout_height="18dip"  /> -->
    <LinearLayout
            android:id="@+id/iconBackgroundLinear"
            android:layout_width="54dip"
            android:layout_height="57dip"
            android:gravity="center">

        <ImageView
                android:id="@+id/app_icon"
                android:layout_width="45dip"
                android:layout_height="45dip"
                android:adjustViewBounds="false"
                />
    </LinearLayout>

    <TextView
            android:id="@+id/app_title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingTop="2dip"
            android:gravity="center_horizontal"
            android:lines="2"
            />
    </LinearLayout>

关键是android:lines="2",当我使用android:maxline="2"时,可能会出现上述错误.

The key is android:lines="2", when I am using android:maxline="2" , it may show above mistake.

这篇关于GridView 无法显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆