我在活动中使用了两个旋转器,但每个旋转器都有不同的外观。任何人都可以帮我解决这种错误??? This is first spinner image
This is second spinner image(请参阅图片)
String [] values =
{"All Town","Paris","Kodambakkam","Nungambakkam","T.Nagar","Egmore"};
Spinner spinner = (Spinner) v.findViewById(R.id.town);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this.getActivity(), android.R.layout.simple_spinner_item, values);
adapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
spinner.setAdapter(adapter);
String [] values1 =
{"Select Doctor","Doctor1","Doctor2","Doctor3","Doctor4"};
Spinner spinner1 = (Spinner) v.findViewById(R.id.doctor);
ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(this.getActivity(), android.R.layout.simple_spinner_item, values1);
adapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
spinner1.setAdapter(adapter1);
XML:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/town" />
<Spinner
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/doctor" /></LinearLayout>
请帮帮我。在此先感谢!!!!
答案 0 :(得分:0)
在第二个微调器上尝试此操作...您已将第一个适配器对象传递给第二个适配器
String [] values1 =
{"Select Doctor","Doctor1","Doctor2","Doctor3","Doctor4"};
Spinner spinner1 = (Spinner) v.findViewById(R.id.doctor);
ArrayAdapter<String> adapter1 = new ArrayAdapter<String>(this.getActivity(), android.R.layout.simple_spinner_item, values1);
adapter1.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
spinner1.setAdapter(adapter1);