0

I need some help for my app. I need a view containing an undefined number of ImageButtons based on a variable. That is, supposing the variable is set to 3, then 3 Imagebutton should be shown on the screen. Is there any way I can build this? I'm trying it using GridView, but it seems that you must provide a fixed number of images to fill Integer[] mThumbIds. Besides, I need the image to change on click event and this doesn't seem possible to accomplish using the GridView.

Another question related to the topic, is there any way I could use an Imagebutton with more than two states? I'd like the Image to display the effect of being establishing a connection when the user taps on it, something like those red stripes that come from the surface of the icon to the outside as if sending a wireless signal, I don't know if you know what I mean...

3
  • what is mThumbIds and where does it comes from ? Commented Mar 19, 2013 at 14:22
  • I'm following the example from the android website: developer.android.com/guide/topics/ui/layout/gridview.html Commented Mar 19, 2013 at 14:27
  • that's an example. it doesn't prevent you from reading the documentation Commented Mar 19, 2013 at 14:28

1 Answer 1

1

GridView will work perfectly for what you want, just use a custom adapter like you would for a ListView, override the getView() method and set your onClickListener there.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.