1

I know well that there are ways of customizing elements like GridView and ListView through the use of Adapters (like BaseAdapter). I am also aware of the Holder paradigm to keep the state of complex data structures.

I am wondering if the RadioGroup works the same. If not how could I implement something like this:

|-------|
| TEXT  |
|-------|
| IMAGE |
|-------|
| RADIO |
|  BUT. |
|-------|

That can be added modularly (programmatically) to a RadioGroup to obtain more complex structures like this one:

|-------|-------|-------|
| TEXT  | TEXT  | TEXT  |
|-------|-------|-------|
| IMAGE | IMAGE | IMAGE |
|-------|-------|-------|
| RADIO | RADIO | RADIO |
|  BUT. |  BUT. |  BUT. |
|-------|-------|-------|

Other solutions that I have found involve Horizontal ListView or customized GridView.

Is there any other Android design pattern that may be followed to achieve a more elegant result?

Thanks.

Community
  • 1
  • 1
2dvisio
  • 861
  • 2
  • 10
  • 29
  • you can use something like this to create custom radiogroup buttons which function like tabs : http://blog.mokriya.com/post/15342694933/custom-tabs-in-android As for your question about adding them dynamically you can set their views visible or not but i dont think that would be the most feasible solution :) – Android2390 Aug 06 '12 at 21:32
  • Thanks @Android2390 probably the only way of doing it is to extend the `RadioButton` class itself and create a custom layout that takes into account all the elements I want. – 2dvisio Aug 07 '12 at 10:46

2 Answers2

0

I'm not sure, if i completely understood your question, but looking at the ilustration, i assume, that you need to extend the ViewGroup class, and add some custom functionality.

Balázs Édes
  • 13,452
  • 6
  • 54
  • 89
  • Thanks @bali182 but I think it is not what I meant. What I meant was something similar to the process in ListView, where you can customize your element in a different XML layout and then expand it (inflate) into your ListView. – 2dvisio Aug 07 '12 at 10:01
0

At the end the only way I've found for doing this is a lot of coding in JAVA. Base adapter + ViewHolder paradigm + hardcoded generation of Linear Layouts with the wanted components.

2dvisio
  • 861
  • 2
  • 10
  • 29