我正在尝试将3个按钮相对于他们的出发点移动:
开始动画的代码是:
protected void showMoreBtns() {
Button btn1 = (Button)this.findViewById( R.id.more1btn );
Button btn2 = (Button)this.findViewById( R.id.more2btn );
Button btn3 = (Button)this.findViewById( R.id.more3btn );
Animation showMore = AnimationUtils.loadAnimation( this, R.anim.optionsinup1 );
btn1.startAnimation( showMore );
showMore = AnimationUtils.loadAnimation( this, R.anim.optionsinup2 );
btn2.startAnimation( showMore );
showMore = AnimationUtils.loadAnimation( this, R.anim.optioninup3 );
btn3.startAnimation( showMore );
}动画被定义为:
xmlns:android="http://schemas.android.com/apk/res/android" >
android:fromXDelta="0"
android:fromYDelta="0"
android:toXDelta="-60"
android:toYDelta="-30" />
所有三个动画都遵循相同的格式,只修改android:toDelta。问题是动画运行,但按钮在动画结束时返回到其原始位置。我希望他们留在终点。