Hopefully you can help me out and help me out fast. So far my application was working fine, but since my phone updated to Lollipop the drawable icons of the lines of the public traffic service are not being coloured properly. Here is how I did it so far:
item = (TextView) convertView;
LayerDrawable layers = (LayerDrawable) context.getResources().getDrawable(R.drawable.shape_circle_gridview_line_element);
GradientDrawable shape = (GradientDrawable) (layers.findDrawableByLayerId(R.id.item_shape_gridview_line_element_circle_top));
shape.setColor(context.getResources().getColor(LineColorChooser.getColor(data.get(position).getTypeId())));
item.setBackgroundDrawable(layers);
Now all the GradientDrawables keep their XML defined values, which looks like this:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/item_shape_gridview_line_element_circle_bottom" >
<shape
android:shape="rectangle" >
<size
android:width="45dp"
android:height="45dp" />
<solid
android:color="#00000000"/>
</shape>
</item>
<item
android:id="@+id/item_shape_gridview_line_element_circle_top"
android:left="5dp"
android:right="5dp"
android:bottom="5dp"
android:top="5dp">
<shape
android:shape="oval" >
<size
android:width="35dp"
android:height="35dp" />
<solid
android:color="#FFFFFFFF"/>
</shape>
</item>
</layer-list>
How can I change the colours runtime? I read that this is not possible anymore with Lollipop, is that true?