Henrik
Henrik

Reputation: 1995

Smartest way to draw 100+ images on screen

I'm going to draw a grid of 10x10 PNG images. Each image is 32x32 px. All of the images are unique. I'm thinking that the easiest way seems to be to put each image in an ImageView.

If adding all ImageView's to the layout would this give me some kind of performance hit?

Would there be any smarter way to draw these images?

Upvotes: 0

Views: 517

Answers (1)

Alex Volovoy
Alex Volovoy

Reputation: 68434

I assume that your grid is a gridview. Than it should have an adapter with your items. There is a getView method in the adapter you need to take look into. You set your images there. I would look at GridView examples and this example

http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List14.html

to take a look how to write efficient adapters.

Upvotes: 2

Related Questions