ListView/ScrollView下的java大位图会减慢滚动速度
我有下面的布局
<LinearLayout xmlns:安卓="http://schemas.安卓.com/apk/res/安卓"
安卓:id="@+id/layout_1"
安卓:layout_height="fill_parent"
安卓:layout_width="fill_parent"
安卓:orientation="vertical"
安卓:background="@drawable/1dot6_mb_bitmap">
<include layout="@layout/top_bar"/>
<LinearLayout
安卓:id="@+id/layout_2"
安卓:layout_height="wrap_content"
安卓:layout_width="fill_parent"
安卓:layout_weight="1"
安卓:orientation="vertical">
<ListView
安卓:id="@+id/layout_3"
安卓:layout_width="fill_parent"
安卓:layout_height="fill_parent">
</ListView>
</LinearLayout>
<include layout="@layout/bottom_bar"/>
当我将大位图设置为layout_1容器的背景时,ListView的滚动速度非常慢。如果我从背景中删除图像,ListView会完美滚动。我也试过使用滚动视图,这是同样的行为。 我不能使用重复图像或9。因为这张大图实际上是一张风景照片。 你知道我该怎么解决这个问题吗?或者ListView/ScrollView在这种情况下运行如此缓慢的原因是什么
谢谢!
# 1 楼答案
假设图像大于其占用的空间,可以将其加载到成员中,在将图像插入布局之前,使用BitmapFactory类调整图像大小