Changing color in a shape inside a layer-list programmatically

别说谁变了你拦得住时间么 提交于 2019-11-27 09:24:52

Ok I found the answer, I just had to put the id of the shape inside the item not in the shape kachel_ticked_style.xml:

<item 
    android:id="@+id/selectable_kachel_shape">
        <shape
             android:shape="rectangle" >
            <stroke
                android:width="5dp"
                android:color="@color/headrbar_color" />
        </shape>
    </item>

And then you can change either the color of the shape calling shape.setColor or the color of the stroke calling shape.setStroke(strokeWidth,strokeColor)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!