动画转换速度

时间:2015-12-14 00:32:39

标签: java android

所以我有这个代码从左到右移动图像,但它位于页面的1/4处,所以不是中间或左边,哪条规则最适合我用它来水平移动它?

@Override
protected void onCreate(Bundle savedInstanceState) {
    getWindow().getDecorView().setSystemUiVisibility(getSystemUiFlags());
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main_page);

    homeLayout = (ViewGroup)findViewById(R.id.HomeLayout);
    homeLayout.setOnTouchListener(new RelativeLayout.OnTouchListener() {

            @Override
            public boolean onTouch(View v, MotionEvent event) {
                moveButton();
                return true;
            }
        }
    );
}

public void moveButton() {
    View plane = findViewById(R.id.AreoplaneImg);

    TransitionManager.beginDelayedTransition(homeLayout);

    RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    params.addRule(RelativeLayout.ALIGN_LEFT, RelativeLayout.TRUE);
    params.width = 700;
    params.height = 90;
    plane.setLayoutParams(params);
}

其次是否会减慢从右到左的过渡,因为它太快了?

0 个答案:

没有答案