zoukankan      html  css  js  c++  java
  • AndroidUI 视图动画-缩放动画效果 (ScaleAnimation)

    放动画效果,可以使用ScaleAnimation;

        <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>
    


    效果:



  • 相关阅读:
    Linux性能监测:磁盘IO篇
    Linux性能监测:网络篇
    Linux性能监测:内存篇
    Linux系统和性能监控之CPU篇
    linux 进程和线程讲解
    web-单机时代
    自动化-ELK日志管理
    自动化--zabbix-proxy
    自动化-zabbix(2)
    IOS中的用户安全
  • 原文地址:https://www.cnblogs.com/raphael5200/p/5114792.html
Copyright © 2011-2022 走看看