2013-03-23 70 views
0

好吧,這可能是一個愚蠢的,但請原諒我,因爲我是Android的新手。我工作的一個應用程序中,我想用遠程URL的喜歡,以顯示視頻縮略圖:顯示來自URL的視頻縮略圖

視頻網址: http://173.193.24.66/~kanz/video/flv/9.flv

.JPG網址: http://173.193.24.66/~kanz/video/Images/9.jpg

我有兩個視頻網址和圖像文件的URL,我想要顯示在SQL數據庫上存儲的縮略圖。唯一的是我不知道如何把它們放在ScrollView中的List視圖中。我試圖在互聯網上搜索,但他們似乎都給出了關於如何從SD卡路徑顯示視頻縮略圖的教程。我想使用這些URL中的任何一個來顯示視頻縮略圖。 我聽說過API,但由於Youtube在我的國家被禁止,所以我無法使用Youtube API。如果有人知道任何有用的API或任何其他破解,讓我知道。它將不勝感激。我正在使用薑餅。

回答

0

列表視圖都有自己的滾動。所以不要把ListView放在滾動視圖中。

使用自定義列表視圖來顯示縮略圖。

讓您的網址形成數據庫。

http://www.androidhive.info/2012/02/android-custom-listview-with-image-and-text/

http://www.youtube.com/watch?v=wDBM6wVEO70。這個談話是關於listview和性能的。

使用一個視圖。 http://developer.android.com/training/improving-layouts/smooth-scrolling.html

如果您在listview中顯示大量圖像,請考慮使用以下某個庫。

1.通用圖像加載器。 https://github.com/nostra13/Android-Universal-Image-Loader

2.Lazy List。 https://github.com/thest1/LazyList

兩者都使用緩存。

對了通用圖像裝載機

在適配器構造

File cacheDir = StorageUtils.getOwnCacheDirectory(a, "UniversalImageLoader/Cache"); 
    imageLoader = ImageLoader.getInstance(); 

    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)//dummy image 
.cacheInMemory() 
.cacheOnDisc() 
.displayer(new RoundedBitmapDisplayer(20)) 
.build(); 

在你getview()

ImageView image=(ImageView)vi.findViewById(R.id.imageview); 
    imageLoader.displayImage(imageurl, image,options); 
+0

相當描述性和非常有用的..謝謝兄弟! – 2013-03-23 13:49:08