I have a round custom shape and I want it to change its color, but I get the shape as a square not round as I want
Here is my shape:
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">
<solid
android:color="#666666"/>
<size
android:width="120dp"
android:height="120dp"/>
in my layout:
<ImageView
android:id="@+id/rgb_led"
android:visibility="gone"
android:layout_width="40dp"
android:layout_height="40dp"
android:background="@drawable/round_led"
android:layout_centerHorizontal="true" />
in code:
ledImageView.setVisibility(View.VISIBLE);
int colorFrom = getResources().getColor(colorFromId);
int colorTo = getResources().getColor(colorToId);
colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
colorAnimation.setDuration(duration);
colorAnimation.setRepeatCount(ValueAnimator.INFINITE);
colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animator) {
ledImageView.setBackgroundColor((int) animator.getAnimatedValue());
}
});
colorAnimation.start();
but I get a flashing square not a round shape!?
EDIT:
I actually would like to animate a round image to get an effect of a flashing colored light that can change colors and flashing duration.
Cheers.