Hello, I need to use Spinner with a little bit complicated look of items. Normally, items are just simple TextViews. My item consists of an image and two TextViews. My layout XML (spinner_item.xml) file for Spinner's item looks like:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ android" android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:id="@+id/spinner_image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="5dip" android:src="@drawable/spinimage" /> <TextView android:id="@+id/spinner_item" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <TextView android:id="@+id/spinner_info_item" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="1111" /> </LinearLayout> I initiate Spinner this way: /* prepares data for spinner */ String data[] = new String[] { "AAA", "BBB", "CCC", "DDD" }; Spinner s1 = (Spinner)tbl.findViewById(R.id.my_spinner); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.spinner_item, R.id.spinner_item, data); adapter.setDropDownViewResource(R.layout.spinner_item); s1.setAdapter(adapter); after operations shown above, I have Spinner which looks like: # AAA1111 # BBB1111 # CCC1111 # DDD1111 where "#" is some image. And my question is: is it possible to programmatically change text "1111" for something else ? I need each Spinner's item to have different "spinner_info_item" text (eg. 11, 22, 33, 44). It is possible to deliver data for only one TextView with ArrayAdapter constructor (I used it to initiate text for first TextView). But, I need to initiate text for second TextView in my Spinner's items, too. I tried to put between "adapter.setDropDown...." and "s1.setAdapter..." this command: ((TextView)(((LinearLayout)adapter.getView(0, null, null)).findViewById(R.id.spinner_info_item))).setText("22222"); which tries to change "spinner_info_item"'s text on first (position = 0) item, but unfortunately without results :( Thanks in advance for your help. Regards, Robbo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] Announcing the new M5 SDK! http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

