-1

このようなライブラリでAndroidアプリケーションを作成していますここに画像の説明を入力

これらすべての本を動的に配置する必要があり、単一の本をクリックすると、デフォルトの pdf リーダーで開くことができます。

私の問題は、リストビューを使用することです.そうでない場合は、適切なアプローチは何ですか.そして、私が見つけることができないいくつかの例を教えてください.

4

1 に答える 1

1

http://code.google.com/p/shelves/ . Romain GUyによるプロジェクト。プロジェクトを見てみる価値があります。

http://code.google.com/p/shelves/source/browse/trunk/Shelves/srchttp://shelves.googlecode.com/svn/trunk/Shelves/ . 読み取り専用です。トランクを開き、コードをコピーして同じものを使用します。

グリッドビューを使用します。 http://developer.android.com/guide/topics/ui/layout/gridview.html

ユニバーサル イメージ ローダー。

https://github.com/nostra13/Android-Universal-Image-Loader .

Lazy List に基づいています (同じ原理で動作します)。しかし、それは他の多くの構成を持っています。より多くの構成オプションを提供する Universal Image Loader を使用することをお勧めします。ダウンロードに失敗した場合、エラー画像を表示できます。角を丸くした画像を表示できます。ディスクまたはメモリにキャッシュできます。画像を圧縮できます。

カスタム アダプター コンストラクターで

  File cacheDir = StorageUtils.getOwnCacheDirectory(a, "your folder");

  // Get singletone instance of ImageLoader
  imageLoader = ImageLoader.getInstance();
  // Create configuration for ImageLoader (all options are optional)
  ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(a)
  // You can pass your own memory cache implementation
 .discCache(new UnlimitedDiscCache(cacheDir)) // You can pass your own disc cache implementation
 .discCacheFileNameGenerator(new HashCodeFileNameGenerator())
 .enableLogging()
 .build();
 // Initialize ImageLoader with created configuration. Do it once.
 imageLoader.init(config);
  options = new DisplayImageOptions.Builder()
  .showStubImage(R.drawable.stub_id)//display stub image
  .cacheInMemory()
  .cacheOnDisc()
  .displayer(new RoundedBitmapDisplayer(20))
  .build();

あなたの getView() で

  ImageView image=(ImageView)vi.findViewById(R.id.imageview); 
  imageLoader.displayImage(imageurl, image,options);//provide imageurl, imageview and options.

ニーズに合わせて他のオプションを設定できます。

遅延読み込み/ユニバーサル イメージ ローダーに加えて、スムーズなスクロールとパフォーマンスのためにホルダーを表示できます。http://developer.android.com/training/improving-layouts/smooth-scrolling.html .

編集:

https://github.com/androidnerds/shelves . zip としてダウンロードするためのリンク。

于 2013-03-28T06:42:50.410 に答える