我正在制作带有多个片段的微调器控件,第一个片段正确显示微调器,然后第二个片段调用然后我设置默认微调器未设置请帮助我,提前谢谢
String[] strArraySpinner = { "Existing Customer ?", "New Customer ?" };
mSpinner.setOnItemSelectedListener(new OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (mSpinner.getSelectedItem().toString().equalsIgnoreCase(strArraySpinner[0])) {
Toast toast = Toast.makeText(mContext, "Item= " + mSpinner.getSelectedItem().toString(), Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
} else if (mSpinner.getSelectedItem().toString().equalsIgnoreCase(strArraySpinner[1])) {
Toast toast = Toast.makeText(mContext, "Item= " + mSpinner.getSelectedItem().toString(), Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
}
});
当我在微调器调用上选择方法时调用第二个片段,这不起作用,
mSpinner.setSelection(); // here i m set on default spinner with prompt