标签:android style blog http io color ar os java
简单实例,图片从远到近、从小到大、从模糊到清晰
main.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent"> <ImageView android:id="@+id/imgShow" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="90dp" android:layout_centerHorizontal="true" android:src="@drawable/ic_launcher" /> <Button android:id="@+id/btnStart" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerHorizontal="true" android:layout_centerVertical="true" android:text="@string/btnStart" /> </RelativeLayout>
main.java protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button btnStart = (Button)findViewById(R.id.btnStart); btnStart.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { ImageView imgShow = (ImageView)findViewById(R.id.imgShow); Animation am = AnimationUtils.loadAnimation(MainActivity.this,R.anim.tween_ani); imgShow.startAnimation(am); } }); }
tween_ani.xml 在res下创建anim文件夹 <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android" > <alpha android:duration="6000" android:fromAlpha="0.0" android:toAlpha="1.0" /> <scale android:interpolator="@android:anim/accelerate_decelerate_interpolator" android:fromXScale="0.0" android:toXScale="1.0" android:fromYScale="0.0" android:toYScale="1.0" android:pivotX="50%" android:pivotY="50%" android:fillAfter="false" android:duration="9000"/> <translate android:fromXDelta="30" android:toXDelta="0" android:fromYDelta="30" android:toYDelta="0" android:duration="10000" /> <rotate android:interpolator="@android:anim/accelerate_decelerate_interpolator" android:fromDegrees="0" android:toDegrees="+360" android:pivotX="50%" android:pivotY="50%" android:duration="10000"/> </set>
各参数介绍:
http://blog.csdn.net/tyzy0613/article/details/40742571
标签:android style blog http io color ar os java
原文地址:http://blog.csdn.net/tyzy0613/article/details/40977347