2012-09-22 48 views
1

我正在用一堆图像按钮做一个scrollView。不幸的是,这个视图需要很长时间才能加载 - 以至于用户可能会认为应用程序是错误的。图像按钮在Android中的缓慢加载时间

有关如何使此过程更快的任何想法?

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" > 

<TableLayout 
    android:layout_height="fill_parent" 
    android:layout_width="fill_parent" 
    > 
    <TableRow> 
     <ImageButton 
      android:id="@+id/ImageButtonCone" 
      android:layout_width="160dp" 
      android:layout_height="200dp" 
      android:scaleType="fitCenter" 
      android:background="@drawable/cone" 
      /> 
     <ImageButton 
      android:id="@+id/ImageButtonCube" 
      android:layout_width="160dp" 
      android:layout_height="200dp" 
      android:scaleType="fitCenter" 
      android:background="@drawable/cube" 
      /> 
    </TableRow> 
      <TableRow> 
     <ImageButton 
      android:id="@+id/ImageButtonCylinder" 
      android:layout_width="160dp" 
      android:layout_height="200dp" 
      android:scaleType="fitCenter" 
      android:background="@drawable/cylinder" 
      /> 
     <ImageButton 
      android:id="@+id/ImageButtonTrapezoidalprism" 
      android:layout_width="160dp" 
      android:layout_height="200dp" 
      android:scaleType="fitCenter" 
      android:background="@drawable/trapezoidal_prism" 
      /> 

等等

+0

有多少个按钮? – Simon

+0

12目前(虽然我想补充更多......可能不得不做第二页) - 在模拟器上正常工作(ish),但在手机上永远占用。 – Kurt

+1

以前从未听说过:仿真器比设备速度更快.. – Ronnie

回答

2

我已经解决了这个问题......我只用了PNG公司在绘制-MDPI文件夹而不是其他绘制文件夹。我已经制作了每个PNG的副本,并将它们粘贴到drawable-ldpi,drawable-mdpi和drawable-xhdpi中,现在它可以在手机和仿真器上非常快速地工作。

假设模拟器采取中等清晰度.png的,但手机想从不同的分辨率采取,并没有能力。