Android 抽屉式Activity
2012-07-17 14:06:29 来源:WEB开发网核心提示:// 回退时的位移动画mStopAnimation = new TranslateAnimation(TranslateAnimation.ABSOLUTE,0,TranslateAnimation.ABSOLUTE,-shift,TranslateAnimation.ABSOLUTE,0,TranslateAnima
// 回退时的位移动画
mStopAnimation = new TranslateAnimation(
TranslateAnimation.ABSOLUTE,
0,
TranslateAnimation.ABSOLUTE,
-shift,
TranslateAnimation.ABSOLUTE,
0,
TranslateAnimation.ABSOLUTE,
0);
// 持续时间
mStartAnimation
.setDuration(DURATION_MS);
// 动画完成时停留在结束位置
mStartAnimation
.setFillAfter(true);
mStartAnimation
.setAnimationListener(new AnimationListener() {
mStopAnimation = new TranslateAnimation(
TranslateAnimation.ABSOLUTE,
0,
TranslateAnimation.ABSOLUTE,
-shift,
TranslateAnimation.ABSOLUTE,
0,
TranslateAnimation.ABSOLUTE,
0);
// 持续时间
mStartAnimation
.setDuration(DURATION_MS);
// 动画完成时停留在结束位置
mStartAnimation
.setFillAfter(true);
mStartAnimation
.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(
Animation animation) {
}
public void onAnimationStart(
Animation animation) {
}
@Override
public void onAnimationRepeat(
Animation animation) {
}
public void onAnimationRepeat(
Animation animation) {
}
@Override
public void onAnimationEnd(
Animation animation) {
// 动画结束时回调
// 将imageview固定在位移后的位置
mCover.setAnimation(null);
@SuppressWarnings("deprecation")
final android.widget.AbsoluteLayout.LayoutParams lp = new android.widget.AbsoluteLayout.LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT,
shift,
0);
mCover.setLayoutParams(lp);
}
});
public void onAnimationEnd(
Animation animation) {
// 动画结束时回调
// 将imageview固定在位移后的位置
mCover.setAnimation(null);
@SuppressWarnings("deprecation")
final android.widget.AbsoluteLayout.LayoutParams lp = new android.widget.AbsoluteLayout.LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.FILL_PARENT,
shift,
0);
mCover.setLayoutParams(lp);
}
});
mStopAnimation
.setDuration(DURATION_MS);
mStopAnimation
.setFillAfter(true);
mStopAnimation
.setAnimationListener(new AnimationListener() {
.setDuration(DURATION_MS);
mStopAnimation
.setFillAfter(true);
mStopAnimation
.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(
Animation animation) {
}
public void onAnimationStart(
Animation animation) {
}
@Override
public void onAnimationRepeat(
Animation animation) {
}
public void onAnimationRepeat(
Animation animation) {
}
更多精彩
赞助商链接