小编use*_*897的帖子

缩放动画后的视图,尚未调整到新位置

缩放动画后的视图尚未调整到新位置。

我使用 android 动画(ScaleAnimation)将布局(启动时的屏幕尺寸)缩放到自身尺寸的 0.95 倍,并且比例参考屏幕中心点。

final AnimationListener al2 = new AnimationListener() {

    @Override
    public void onAnimationStart(Animation arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onAnimationRepeat(Animation arg0) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onAnimationEnd(Animation arg0) {

    }
};
public void animScale(){
    ScaleAnimation sa = new ScaleAnimation(1,0.95f,1,0.95f, topLayout.getMeasuredWidth()/2, topLayout.getMeasuredHeight()/2);
    sa.setDuration(500);
    sa.setFillEnabled(true);
    sa.setFillAfter(true);
    sa.setAnimationListener(al2);
    topLayout.startAnimation(sa);

}

public void onCreate(Bundle savedInstanceState) {   

    scaleButton = (Button) findViewById(R.id.scaleButton);
    scaleButton.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View arg0) {
            // …
Run Code Online (Sandbox Code Playgroud)

animation android

5
推荐指数
1
解决办法
1850
查看次数

标签 统计

android ×1

animation ×1