I'm trying to remove the default highlight effect for Spinner item's onClick
. I have my own specific spinner background which have radius in its corners. When I applied the new background, it still has its default background under my custom background. I've tried styling like this:
<style name="ExternalPSpinnerTheme" parent="Widget.AppCompat.Spinner.DropDown">
<item name="android:listSelector">@color/transparent</item>
<item name="android:listChoiceBackgroundIndicator">@color/transparent</item>
<item name="android:listChoiceIndicatorSingle">@color/transparent</item>
<item name="android:selectableItemBackground">@color/transparent</item>
<item name="android:background">@drawable/spinner_sortfriend_background</item>
<item name="android:cacheColorHint">@android:color/transparent</item>
<item name="android:popupBackground">@drawable/spinner_sortfriend_background</item>
<item name="android:dropDownSelector">@color/transparent</item>
</style>
I've tried changing the parent to Widget.AppCompat.Spinner
but it didn't work.. PopupBackground
and background
works tho.
The other question is questioning on how to hide dividers and add its own spinner custom implementation, mine is asking about how to remove the default onClick
highlight effect on the background. How did I try to achieve it? This is how:
if (position > 0 &&
(position + 1) < mDataset.size()){
divider.setVisibility(View.VISIBLE);
convertView.setBackground(ContextCompat.getDrawable(context, R.drawable.spinner_dropdown_background_middle_white_to_migrey));
} else if (position == 0){
divider.setVisibility(View.VISIBLE);
convertView.setBackground(ContextCompat.getDrawable(context, R.drawable.spinner_dropdown_background_top_white_to_migrey));
} else if (position + 1 == mDataset.size()){
divider.setVisibility(View.GONE);
convertView.setBackground(ContextCompat.getDrawable(context, R.drawable.spinner_dropdown_background_bottom_white_to_migrey));
}
And I still didn't get the right answer, I even tried the solution in the other question. I just realized something tho, only the background on the first item overlaps with my custom background click effect, but the one at the end of the list doesn't get overlapped.. Weird..
Any solution?