在android屏幕上随机移动按钮

在android屏幕上随机移动按钮,android,button,move,Android,Button,Move,我是android开发的新手。我想在屏幕上有一个连续移动的单按钮。当它接触到侧面时,应该会反弹。单击会打开活动。我该怎么做?有什么有用的链接吗?思想?谢谢 要移动按钮,需要使用动画 这是一小片 TranslateAnimation mAnimation = new TranslateAnimation( TranslateAnimation.RELATIVE_TO_PARENT, 1f,

我是android开发的新手。我想在屏幕上有一个连续移动的单按钮。当它接触到侧面时,应该会反弹。单击会打开活动。我该怎么做?有什么有用的链接吗?思想?谢谢

要移动按钮,需要使用动画 这是一小片

TranslateAnimation  mAnimation = new TranslateAnimation(
                            TranslateAnimation.RELATIVE_TO_PARENT, 1f,
                            TranslateAnimation.RELATIVE_TO_PARENT, -1.2f,
                            TranslateAnimation.ABSOLUTE, 0f,
                            TranslateAnimation.ABSOLUTE, 0f
                           );
                   mAnimation.setDuration(15000);
                   mAnimation.setRepeatCount(-1);
                   mAnimation.setRepeatMode(Animation.INFINITE);
                   mAnimation.setInterpolator(new LinearInterpolator());
                   mAnimation.setFillAfter(true);

                    LinearLayout alertlayout = (LinearLayout) findViewById(R.id.alertll);
                    alertlayout.startAnimation(mAnimation);
以及开展一项新的活动

Intent intent = new Intent(YourActivity.this,NewActivity.class);
StartActivity(intent);

在提出问题之前,你试过什么吗?请描述你的努力。激励。你介意解释一下设定重复次数的作用吗?这将如何随机移动?非常感谢你!还有,这会反弹吗?现在有更多更复杂的库可用。。。试着用那个