Hi there,
In my app, I'm using a gallery with an Array of strings, and an
ArrayAdapter. I'm using a colorStateList for the text color, to show
the selected item in green. When the user interacts with the gallery,
dragging, clicking or flinging, the green color appears correctly for
the selected item. But the initial selected item doesn't show in
green. And if I programmatically set the selected index of the
gallery, the selected item doesn't' show in green.
I didn't find this issue in my searches.
I have defined the TextView used to display the strings in a layout
file, gallery_item.xml
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:textColor="@color/gallery_text_color">
</TextView>
The color state list is:
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:color="#ff9aca3c"/>
<item android:state_focused="true" android:color="#ff9aca3c"/>
<!-- Just to be safe -->
<item android:color="#ffffffff"/>
</selector>
Does anyone know why the initially selected TextView would be showing
the default white color? I get a callback to onItemSelected with
position == 0, so I know the item is being selected. Just the
formatting is off.
Thanks,
MB
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en