试图让一个按钮在一个圆形的安卓工作室移动



我试图在纵向模式下使按钮在圆圈中移动,而在横向模式下我试图隐藏按钮。我在主要活动中使用了这个。在横向模式下,我使用命令android:visibility="消失了";但并没有真正起作用,可以看到按钮的轮廓在移动。我如何解决这个问题

主要活动

protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Button but1 = (Button)findViewById(R.id.but1);
RotateAnimation rC = new RotateAnimation(360,0,Animation.RELATIVE_TO_PARENT,0.2f,Animation.RELATIVE_TO_PARENT, 0.2f);
rC.setDuration(1000);
rC.setInterpolator(new LinearInterpolator());
rC.setRepeatMode(Animation.RESTART);
rC.setRepeatCount(Animation.INFINITE);
but1.startAnimation(rC);
}

再次调用旋转方法onCreate后,应检查是否处于横向模式,并且不运行按钮的动画,即所有

相关内容

最新更新