How to use Droid Fu WebGalleryAdapter?
I am using Droid fu's library which is GREAT! Im having problems开发者_JAVA技巧 implementing the webgalleryview though. I dont know how to go about implementing it.
I want it to display some images from a url. And cache the images. How would i do this with droid fu's library? WebGalleryAdapter.
Create an activity and bind a XML layout to it with a Gallery in it. Put it on Fill_Parent. Then simply put this code in your activity:
// Create a list of url's
List<String> imageURLs = new ArrayList<String>();
imageURLs.add("http://www.example.com/1.jpg");
imageURLs.add("http://www.example.com/2.jpg");
// Etc.
// Creates an adapter with the image url's for the overwritten getView method.
WebGalleryAdapter webGalleryAdapter = new WebGalleryAdapter(this, imageURLs);
// Get the gallery from the XML layout and set the web adapter.
Gallery gallery = (Gallery) findViewById(R.id.gallery);
gallery.setAdapter(webGalleryAdapter);
精彩评论