I have a layout with some ImageView like this:
As mention in the imageView corner's not remains rounded when used Animation on it.
How to make it rounded while using Animation on it?
Layout Code:
<TableLayout
android:layout_width="wrap_content"
android:id="@+id/table1"
android:gravity="center"
android:layout_height="wrap_content">
<TableRow>
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="@+id/img1_1"
android:background="@drawable/button"
android:layout_margin="3dp"
/>
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="@+id/img1_2"
android:background="@drawable/button"
android:layout_margin="3dp"
/>
</TableRow>
<TableRow>
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="@+id/img1_3"
android:background="@drawable/button"
android:layout_margin="3dp"
/>
<ImageView
android:layout_width="60dp"
android:layout_height="60dp"
android:id="@+id/img1_4"
android:background="@drawable/button"
android:layout_margin="3dp"
/>
</TableRow>
</TableLayout>
Java Code:
ObjectAnimator animator = ObjectAnimator.ofInt(findViewById(id), "backgroundColor", Color.RED, Color.parseColor("#4caf41")).setDuration(5000);
Toast.makeText(Game.this, "index" + findViewById(id), Toast.LENGTH_LONG).show();
animator.setEvaluator(new ArgbEvaluator());
animator.start();
I have resolve this issue to made chage in this line:
ObjectAnimator animator = ObjectAnimator.ofInt(findViewById(id), "backgroundColor", Color.RED, Color.parseColor("#4caf41")).setDuration(5000);
like this:
ObjectAnimator animator = ObjectAnimator.ofInt(findViewById(id), "backgroundResource", R.drawable.original_img, R.drawable.org_state).setDuration(2000);
i.e
I have set backgroundResource instead of backgroundColor.and set a image instead of hexcolor code.