Multiple Columns on a Spinner?

2019-09-14 18:45发布

问题:

I've been trying for ages and ages to get a custom spinner to work and basically nothing will work.

I've been after something like this:

http://www.f1-manager.co.uk/Misc/CustomSpinner.png

Basically I want to display 3 items from a database, the first name, last name and some other bits of information on the Other Info bit and then of course a picture of said person.

Is this even possible? I was told that using a custom spinner can achieve this but I can't find a good enough example to help me.

Any help would be great. :-)

Thanks, Chris

回答1:

Use a TableLayout to design the UI for the items in the spinner. Then in your adapter, just fill out the layout content as you would any other layout.

Here is layout design of what I mean:

TableLayout
    TableRow
        TextView -> FirstNameHeader
        TextView -> LastNameHeader
    TableRow
        TextView -> FirstNameData
        TextView -> LastNameData
    TableRow
        TextView -> OtherData