简体   繁体   中英

Customizing an image gallery in android

I swear, this control has been the bane of my existance this week. Just FYI, I have pretty basic OO/Java skills, I've mainly been using xml to create layouts, but I need to use the gallery control. I've finally got the sample code working from the sdk, but one thing remains a mystery despite looking here, googling elsewhere, etc., there seems to be no clear answer on how you exactly manipulate the attributes of individual images within the gallery. I keep looking for an example of a template that I could implement, but see nothing. Really, I'm not looking for anything fancy, I just want the images to scale properly within a fixed height gallery control, and surround each image with a 1dip light border, and keep each of them about 4dip apart from one another, that's about it. But for the life of me I'm just not seeing how to make these customizations, and I'm starting to tear my hair out! :-/ Any help or reference to how to do this with some actual examples would be priceless!

Yeah, just to continue on your own answer.

The getView() method of the adapter is the place where you'll do anything you want with the images, ie set up borders, layout params, lazy loading, etc.

As long as the method returns the View you've made changes to, it should work just fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM