I’m fairly new to the whole android-scene so please bear with me. I’m trying to create a button layout like the preference buttons, but I cant seem to get it working properly. To visualize my question, take a look
at this image!
I’d like to create buttons like those, with the image and all, thanks in advance.
Don’t use buttons. Use a ListView in your activity which uses a LinearLayout for each line; the LinearLayout (which is set to horizontal) in turn contains the image and the text. To fill up the list, you use a custom ListAdapter as PravinCG has said. Use an OnItemClickListener to act.
I.e.: The main layout:
The row_layout:
Create a new adapter in your activity (extends ListActivity) – this code assumes you have an instance of a class “YourButtonClass” for each “button” (=row):
Finally, instantiate it in onCreate() and add a listener.
There you go.