我正在尝试从我的以下片段中的一个字符串数组中设置我的微调器的 onCreateView
值public final class Manual extends Fragment
:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.manual, container, false);
String [] values =
{"Time at Residence","Under 6 months","6-12 months","1-2 years","2-4 years","4-8 years","8-15 years","Over 15 years",};
Spinner spinner = (Spinner) v.findViewById(R.id.spinner1);
ArrayAdapter<String> LTRadapter = new ArrayAdapter<String>(this.getActivity(), android.R.layout.simple_spinner_item, values);
LTRadapter.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
spinner.setAdapter(LTRadapter);
return inflater.inflate(R.layout.manual, container, false);
}
我的代码没有错误,但它没有设置微调器。微调器保持空白,没有值。关于为什么我的代码没有设置微调器的任何想法?