Spinner在android中没有打开触摸

时间:2015-07-17 11:01:38

标签: spinner android-spinner

我正在实现微调器但是当我触摸微调器或单击该微调器时,下拉列表没有打开。微调器数组有三个值。父布局是线性布局 XML

        <Spinner
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/spinnerQuestions"
        android:layout_weight="1"/>

        activity :-
        ques =   getResources().getStringArray(R.array.select_question);
        ArrayAdapter <String> adapter = new ArrayAdapter<String> (this,     R.layout.spinner_item, ques)
{
public View getView(int position, View convertView, ViewGroup parent) {
View v = super.getView(position, convertView, parent);
return v;
}
public View getDropDownView(int position1,  View convertView1,          ViewGroup parent1) {
View v =super.getDropDownView(position1, convertView1, parent1);
return v;
}
};
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
spinnerQues.setAdapter(adapter);
spinnerQues.setOnItemSelectedListener(new       AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
 questionId = String.valueOf(position);
}
@Override
public void onNothingSelected(AdapterView<?> parent) {
        }
    });

1 个答案:

答案 0 :(得分:0)

问题已解决 我正在使用ActionBar活动。 所以我得到了问题。当我将ActionBarActivity更改为活动问题已解决。