android动画的加速器类Interpolator是用来描述动画运行时动画速率的快慢的类。
AccelerateDecelerateInterpolator An interpolator where the rate of change starts and ends slowly but accelerates through the middle.
AccelerateInterpolator* An interpolator where the rate of change starts out slowly and and then accelerates.
AnticipateInterpolator An interpolator where the change starts backward then flings forward.
BounceInterpolator - An interpolator where the change bounces at the end.*
DecelerateInterpolator An interpolator where the rate of change starts out quickly and and then decelerates.
LinearInterpolator An interpolator where the rate of change is constant
OvershootInterpolator An interpolator where the change flings forward and overshoots the last value then comes back.
布局文件activity_layout源代码:
<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" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.example.testactivity.MainActivity" > <TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> <Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignLeft="@+id/textView1" android:layout_below="@+id/textView1" android:layout_marginTop="27dp" android:text="移动" /></RelativeLayout>MainActivity源代码:
public class MainActivity extends Activity { @Override PRotected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewById(R.id.button1).setOnClickListener( new View.OnClickListener() { @Override public void onClick(View arg0) { // TODO Auto-generated method stub Animation animation = AnimationUtils.loadAnimation( MainActivity.this, R.anim.animation); findViewById(R.id.textView1).startAnimation(animation); } }); }}新闻热点
疑难解答