-1

ユーザーがクリックすると編集されるさまざまな画像を含むリストビューを表示するアプリを開発しています。

これは私の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 フォルダーに保存されている 1 セットの画像のみを使用しています (ビットマップとして編集するために元のサイズを維持する必要があるため)。

問題は、これらの画像が大きすぎて単一のアクティビティで表示できないことです。そのため、リストビューを作成すると大量のメモリが使用され、リストがスクロールするのに遅れが生じます。この問題なくリストにこれらの画像を表示するにはどうすればよいですか? リストで使用するには、別の小さな画像セットを作成する必要がありますか? アプリが画像をSDカードまたはキャッシュメモリに保存するときの投稿を読みましたが、実際には、特定のアプリケーションに最適なソリューションについてはわかりません.

前もって感謝します

4

4 に答える 4

0

Aquery を使用して画像をダウンロードすることをお勧めします。このリンクからjarファイルをダウンロードするだけです

使い方 :

AQuery _aq = new AQuery(youractivity context);

//fetch and set the image from internet, cache with file and memory 
aq.id(R.id.your_imageview_object).image("http://www.vikispot.com/z/images/vikispot/android-w.png");
于 2014-03-14T04:25:20.287 に答える