How can I change the <solid android:color= />
programmatically?
I defined a custom shape element: my_item.xml:
<shape android:shape="oval">
<solid android:color="#FFFF0000"/>
</shape>
And reuse it in another layout: grid_view.xml:
<LinearLayout>
<ImageView ... android:src="@drawable/my_item"
android:id="@+id/myitemid" />
</LinearLayout>
The following does not work:
public class ShapeItemAdapter extends BaseAdapter {
@Override
public View getView(int i, View view, ViewGroup viewGroup) {
view = inflter.inflate(R.layout.grid_view, null);
ImageView shape = (ImageView) view.findViewById(R.id.myitemid);
shape.setBackgroundColor(0xBCCACA); //does not work
}
}