The following spinner is still clickable to show the list:
<Spinner
android:id="@+id/spinnerFoo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginLeft="15dp"
android:gravity="center"
android:clickable="false"/>
Could anyone shed some light on this? I know from my reading that one can disable a spinner by doing it in Java code (spinnerFoo.setEnabled(false). My question is about doing it in XML.
[EDIT] The following is all the Java code using the spinner:
ArrayAdapter<Integer> adapterFoo = new ArrayAdapter<Integer>(this, R.layout.spinner_item, aiFoo);
spinnerFoo = (Spinner) findViewById(R.id.spinnerFoo );
spinnerFoo .setAdapter(adapterFoo );
spinnerFoo .setSelection(1);
Clickable is not going to stop the spinner from opening because it does not depend on click event.You have to use android:enabled="false"
EDIT You can set this in the Java code itself, instead of in the XML, because the Spinner should implement setEnabled(boolean) from View
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With