I have a gallery widget, when you scroll it, there is a border in the currently selected image - just a simple selector, like this
<selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_selected="true" android:drawable="@drawable/thumbnail_frame" /> <item android:drawable="@android:color/transparent" />
and in the gallery adapter getView is attached in this way
image.setBackgroundDrawable(getResources().getDrawable(R.drawable.xxx));
The problem is that when you change the gallery selection using setSelection (), the selected item has no border. But when I just scroll it using the border of the finger on the selected item, it works fine. I think setSelection () does not fire setSelected () or something like that.
I guess the solution would be to call setSelected () along with setSelection (), but what can I name it for the currently selected ImageView? Or is there another way to do this?
source share