我正在开发一个应用程序,它显示一个列表视图,其中包含在用户单击它们时编辑的不同图像。
这是我的 row.xml 文件的代码。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="80dp"
android:layout_height="80dp"/>
<TextView
android:id="@+id/textView1"
android:layout_marginTop="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:layout_marginLeft="8dp"
android:text="TextView"
android:textSize="25sp"
/>
我只使用一组图像,存储在文件夹 res/drawable/drawable-nodpi 中(因为我需要它们保持其原始大小以便将它们编辑为位图)。
问题是这些图像太大也显示在单个活动中,因此,当我创建列表视图时,它使用大量内存并且列表滚动时有一些滞后。如何在没有此问题的情况下在列表中显示这些图像?我应该创建另一组较小的图像以在列表中使用它们吗?当应用程序将图像保存到 SD 卡或缓存时,我已经阅读过帖子,但实际上我不确定最适合我的特定应用程序的解决方案。
提前致谢