Spinner Items Not Clickable
Solution 1:
After spending entirely one day with this i figured out that the problem was caused by
<itemname="android:inputType">textCapCharacters</item>
that was in my styles.xml file. I have no idea why this line of code caused the error but at least it works now after i removed that line. Below a full copy of my styles.xml file prior to removing the faulty line
<!-- Base application theme. --><stylename="AppTheme"parent="Theme.AppCompat.Light.DarkActionBar"><!-- Customize your theme here. --><itemname="colorPrimary">@color/colorPrimary</item><itemname="colorPrimaryDark">@color/colorPrimaryDark</item><itemname="colorAccent">@color/colorAccent</item><itemname="android:textColor">@color/white</item><itemname="android:inputType">textCapCharacters</item><itemname="colorControlActivated">@color/white</item><itemname="colorControlHighlight">@color/white</item><itemname="colorControlNormal">@color/white</item></style>
I hope this helps someone in the future
Solution 2:
SOMETIMES THE ISSUE MAY ALSO BE BECAUSE YOU HAVE PLACED YOUR SPINNER OUTSIDE THE LAYOUT YOU ARE CALLING . THIS WILL NOT SHOW ANY ERROR BUT YOU WILL NOT BE ABLE TO INTERACT WITH THE SPINNER VIEW
Solution 3:
You can use onItemClickListener like below
spinner.setOnItemClickListener(newAdapterView.OnItemClickListener() {
@OverridepublicvoidonItemClick(AdapterView<?> parent, View view, int position, long id) {
Toast.makeText(getApplicationContext(), "Item number: " + position, Toast.LENGTH_LONG).show();
}
});
Solution 4:
Try removing the xml attribute android:clickable="true"
from the Spinner
widget. It could be that the entire spinner is registering the click event rather than the individual spinner items.
Possible duplicate of Spinner functionality issues in Android 6.0 Marshmallow
Post a Comment for "Spinner Items Not Clickable"