I've done a Gallery view composed by just textviews as numbers. By default if I don't set any colors the item in the centre is black. I want to change it.
Using a selector it doesn't work, any ideas?
UPDATE: if I try to use a selector also the default behavior gone and I can see only grey textview
So, this is the getVIew of my TextAdapter that extends BaseAdapter
public View getView(int position, View convertView, ViewGroup parent) {
TextView t = new TextView(mContext);
int val = position + 1;
t.setText("" + val);
t.setTextSize(30f);
t.setTextColor(R.drawable.numericgallery_selector);
return t;
}
and this is my selector.
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:color="#FDF132"></item>
<item android:state_selected="false" android:color="#CADDCD"></item>
<item android:color="#FFFFFF"></item>
</selector>
but it doen't work.... :(
I found my old post with no solution. So I tell you how I worked it out.
t.setTextColor(mContext.getResources().getColorStateList(R.drawable.numericgallery_selector));