【发布时间】:2012-02-16 08:27:38
【问题描述】:
我在绝对布局中制作了一些 Imagebuttons,然后使用它的所有按钮旋转整个布局,现在我遇到了一个问题,即 imagebuttons 的操作可能不起作用,因为该操作没有使用 imagebutton 旋转
如果有人知道发生了什么请告诉我
main.xml
<AbsoluteLayout
android:id="@+id/wheelLayout"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_x="-250px" android:clickable="true">
<ImageView
android:id="@+id/wheelBG"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/wheel"/>
<ImageButton
android:id="@+id/accounts"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="258dp"
android:layout_y="222dp"
android:background="@null"
android:onClick="accountsOnClick"
android:src="@drawable/accounts"/>
<ImageButton
android:id="@+id/cards"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_x="228dp"
android:layout_y="291dp"
android:background="@null"
android:onClick="cardsOnClick"
android:src="@drawable/cards"/>
</AbsoluteLayout>
然后我做了一个函数来使用 RotateAnimation 旋转整个绝对布局并在特定的持续时间内倾斜
我已经定义了按钮的动作
public void accountsOnClick(查看视图) { System.out.println("imageButton1OnClick"); }
旋转前动作正常,但旋转后动作不正常
【问题讨论】:
-
好吧,你的代码有些奇怪,不是吗?
-
仅供参考,AbsoluteLayout 已弃用
-
我知道它已被弃用,我在 2.1 平台上工作,我真的需要按圆形顺序放置 Imagebuttons 以适合我的设计,所以我没有找到任何其他布局可以让我设置了 x, y 的项目,除了绝对布局,如果您有任何其他可以帮助的想法,我将不胜感激
标签: android android-layout android-button