Wednesday 18 September 2013

Dynamic radial circle in the middle of the screen

Dynamic radial circle in the middle of the screen

Why is it so difficult to make this little thing work? : /
I want to create something like android's lock screen. I have an XML:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" >
<stroke
android:width="@dimen/dp_5"
android:color="@color/black" />
<gradient
android:type="radial"
android:startColor="@color/green"
android:endColor="@color/red"
android:gradientRadius="@dimen/dp_50" />
</shape>
This circle is a background of a TextView, so the following happens:
1. wrap_content creates a little circle in the center of the screen
2. fill_parent creates an elipse taking the whole screen, instead of a circle

In addition I would like to change the startColor and endColor
programmatically - Didn't find any documentations\threads which solved
this SIMPLE issue.

No comments:

Post a Comment