AndroidUI 视图动画-缩放动画效果 (ScaleAnimation)
2015-10-01 19:57
543 查看
放动画效果,可以使用ScaleAnimation;
代码 :
XML:
效果:
<Button android:id="@+id/btnScale2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_below="@+id/btnScole" android:layout_centerHorizontal="true" android:layout_marginTop="77dp" android:text="@string/btnScale2" />
代码 :
@Override public void onClick(View v) { //从相对位置 的起点开始缩放动画 //ScaleAnimation scale=new ScaleAnimation(0, 1, 0,1); //从相对位置的100px x 100px的位置开始动画 //ScaleAnimation scale=new ScaleAnimation(0, 1, 0,1,100,100); //从按钮自身的中心点开始缩放动画 //ScaleAnimation scale=new ScaleAnimation(0, 1, 0,1,Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF,0.5f); //scale.setDuration(2000); //v.startAnimation(scale); //使用XML配置缩放动画 v.startAnimation(AnimationUtils.loadAnimation(v.getContext(), R.anim.scale2)); } });
XML:
<scale xmlns:android="http://schemas.android.com/apk/res/android" android:fromXScale="0" android:toXScale="1" android:fromYScale="0" android:toYScale="1" android:pivotX="50%" android:pivotY="50%" android:duration="2000"> </scale>
效果:
相关文章推荐
- HDU 3721 - Building Roads(DFS`树的直径)
- AndroidUI 视图动画-移动动画效果 (TranslateAnimation)
- AndroidUI 视图动画-移动动画效果 (TranslateAnimation)
- POJ 2785:4 Values whose Sum is 0 二分
- POJ 2785:4 Values whose Sum is 0 二分
- 完美解决amzonui里面input和icon布局问题
- UI:文件操作、通知中心
- UITabBarController详细说明(简介和设置)
- 《Hadoop: The Definitive Guide》读书笔记 -- Chapter 1 Meet Hadoop
- js中关于value的一个小知识点(value既是属性也是变量)
- easyui datagrid加载数据和分页
- UIButton是UIImageView的子控件无法与用户交互
- 显示器 RUIGE瑞鸽高清显示器TL-S1700HD
- 远程调用服务(RPC)和消息(Message Queue)对比及其适用/不适用场合
- UIDynamic-动力效果
- poj(2299)——Ultra-QuickSort(归并排序求逆序数)
- iOS UITextView的使用(小小阅读器实现)
- ZOJ-1649 Rescue
- BlockingQueue
- How do you make Ubuntu accept files sent over bluetooth