【发布时间】:2012-03-21 22:23:32
【问题描述】:
我有一个带有一些按钮的相对布局,我创建了一个旋转动画来旋转它
但是当我旋转它时,按钮的动作不能正常工作,按钮的动作仍然保存旋转前按钮的旧位置
谁能帮我解决这个问题
<ImageButton
android:id="@+id/last20"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="75dp"
android:background="@null"
android:src="@drawable/last20_selector"
android:onClick="last20OnClick"/>
super.onCreate(savedInstanceState);
setContentView(R.layout.wheel);
RelativeLayout layout = (RelativeLayout) findViewById(R.id.wheelLayout);
RotateAnimation rotateAnim = new RotateAnimation(0, 45,
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
0.5f);
rotateAnim.setDuration(1000);
rotateAnim.setRepeatCount(0);
rotateAnim.setFillAfter(true);
layout.startAnimation(rotateAnim);
}
public void last20OnClick(View view) {
System.out.println("last20OnClick");
}
【问题讨论】:
-
你找到解决办法了吗?面临同样的问题。
-
不,我没有找到解决方案,我使用画布构建控件并停止使用绝对布局。
标签: android android-layout android-button