我有一个CirceImageView如下
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/circleImageView_right_arrow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_keyboard_arrow_right"
android:layout_marginLeft="20dp"
android:layout_marginStart="20dp"
android:background="@drawable/imageview_border"
android:clickable="true"
android:focusable="true"/>
imageview_border.xml如下
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<!--<stroke
android:width="5dp"
android:color="@color/light_green" />-->
<corners
android:radius="1000dp" >
</corners>
<!--<solid
android:color="@color/light_green">
</solid>-->
</shape>
当我在CircleImageView上应用动画时,视图变成一个正方形。为什么会发生这种情况,如何避免将其变成正方形?
int colorFrom = getResources().getColor(R.color.light_green); // The color to change from
int colorTo = getResources().getColor(R.color.colorPrimary); // The color to change to
ValueAnimator colorAnimation = ValueAnimator.ofObject(new ArgbEvaluator(), colorFrom, colorTo);
colorAnimation.setDuration(1000); // milliseconds
colorAnimation.setRepeatCount(-1); // INFINITE
colorAnimation.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator animator) {
mRightArrowCircleImageView.setBackgroundColor((int) animator.getAnimatedValue());
}
});
colorAnimation.start();