displaying clickable images programmatically

Problems with Canvas, OpenGL, etc...

displaying clickable images programmatically

Postby juszczec » Fri Sep 10, 2010 11:55 am

Hi folks

I want to display a bunch (number determined at run time) of closed boxes (same png file displayed multiple times) on the screen in columns.

When the users clicks on one of the boxes, the image will switch from a closed box to an open box (another png file) and some info will be displayed.

I can't specify the boxes via an xml file, because the number of them I'm displayed is determined at run time. I'm having a hard time figuring out what Android objects to use. I'm using a LinearLayout (orientation=vertical) containing 2 ImageViews and want to put all my boxes in the top ImageView.

Would I create the box images as Drawables? How do I position them on the ImageView in columns without hardcoding the space between them? Is it possible to hook an onClickLIstener to a Drawable?

I'm pretty sure I could figure out how to do this with TextBoxes, but I think the box icons would make for a more visually appealing app.

Junior Developer
Junior Developer
Posts: 10
Joined: Wed Aug 25, 2010 3:27 pm


Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 2 guests