我正在使用Spinner显示一些值.而奇怪的是这个问题
我也试过AppCompatSpinner,结果是一样的. @H_403_3@main.xml中:
@H_403_3@The dropdown is displaying correctly,but when I select any item from dropdown,is not displayed in the Box.@H_403_3@而且奇怪的是,该功能在6.0.1之前的所有Android操作系统(即6.0.0和之前版本)上都有效.
我也试过AppCompatSpinner,结果是一样的. @H_403_3@main.xml中:
<Spinner android:id="@+id/spinner" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_weight="0.3" android:entries="@array/values" />@H_403_3@Main.java:
Spinner spinner = (Spinner) findViewById(R.id.spinner); spinner.setSelection(5); // Not displaying 5th item,Yes! there are more than 5 items. spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent,View view,int position,long id) { spinner.setSelection(position); } @Override public void onNothingSelected(AdapterView<?> parent) { spinner.setSelection(5); } });