multiple spinner but one in xml

2019-08-08 17:13发布

问题:

Hi please look at my xml file, very straight and simple, one textView and one Spinner

                <TextView android:id="@+id/TextViewContactNamesTexting"
                android:layout_height="wrap_content" android:layout_gravity="center_vertical"
                android:text="name" android:layout_width="fill_parent"
                android:textColor="@color/font" android:textSize="15sp"></TextView>

            <Spinner android:layout_height="wrap_content"
                android:layout_width="fill_parent" android:layout_marginLeft="10px"
                android:id="@+id/SpinnerNumTexting"></Spinner>

in run time I would like to generate as many as I want depending on an arrayList. I attach the picture which explains my thought better. any suggestion? I know how to fill the spinner appropriately, just stuck on generating more than one :(

thanks in advance...

回答1:

Use a ListView, with a SimpleAdapter. A quick Google search will turn up a number of tutorials on using a SimpleAdapter.