安卓列表查看背景图像真的很慢



我有以下问题:我正在使用带有主题背景图像的常规列表视图,这让我非常头疼的性能问题。当我删除窗口(请参阅主题.xml)背景图像时,一切都很光滑。使用背景图像时,它明显变慢。

我已经尝试过:

  • android:cacheColorHint="#00000000"
  • listview.setScrollingCacheEnabled(false);

但没有任何效果。我不明白为什么这这么慢,因为 ListView 只是纯白色 - 应该不是问题......

主题.xml:

 <item name="android:windowBackground">@drawable/window_bg</item>

列表.xml

<RelativeLayout 
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:orientation="vertical"
  android:padding="10dp">
  <ListView
        android:id="@+id/my_list"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@color/white"/>
</RelativeLayout>

如果它只是白色背景,那么看看是否可以将背景颜色设置为白色而不是使用可绘制对象。事情会立即加速!

最新更新