如何在 XML 设计中为旋转器设置相同的外观?
How to set same appearance for spinner in XML design?
我在 activity 中使用了两个微调器,但每个微调器都有不同的外观。任何人都可以帮我解决这种错误???
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>
请帮帮我。提前致谢!!!
在第二个微调器上试试这个...你已经将第一个适配器对象传递给第二个适配器
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);
我在 activity 中使用了两个微调器,但每个微调器都有不同的外观。任何人都可以帮我解决这种错误??? 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>
请帮帮我。提前致谢!!!
在第二个微调器上试试这个...你已经将第一个适配器对象传递给第二个适配器
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);