动画效果--Android

来源:互联网 发布:天刀捏脸数据导出 编辑:程序博客网 时间:2024/06/06 06:48

1.垃圾回收的效果:

<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android"    android:fillAfter="true"    android:shareInterpolator="false" >    <rotate        android:duration="1500"        android:fromDegrees="0"        android:pivotX="50%p"        android:pivotY="0%p"        android:toDegrees="90" />    <scale        android:duration="1500"        android:fromXScale="1"        android:fromYScale="1"        android:pivotX="50%"        android:pivotY="50%"        android:toXScale="0"        android:toYScale="0" /></set>
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="match_parent"    android:layout_height="match_parent"    android:gravity="center"    android:orientation="vertical" >    <ImageView        android:id="@+id/view0"        android:layout_width="wrap_content"        android:layout_height="wrap_content"        android:src="@drawable/icon_index_contact" /></LinearLayout>

 2.解决动画移动后Button无法相应点击事件

//button在移动,并停止在移动的位置,后无法响应点击事件,//因为button的真实坐标没有改变,点击原来的地方还会有响应的,所处理方法是,设置动画监听,在end中将view的动画去除,并计算出当前坐标用layout,重新布局mView[index].clearAnimation();//重新布局mView[index].layout(mXY[0], mXY[1] - mXY_diff[1], mXY[0]                        + mView[index].getWidth(),                        mXY[1] + mView[index].getHeight() - mXY_diff[1]);

 

0 0