我有一个包含在 RelativeLayout 中的图像视图。单击 imageview 时,我使用平移动画为整个 RelativeLayout 设置动画以将其向下移动。
当我再次单击图像视图(在它的新位置)时,它应该将其移回,但事实并非如此。但是,如果我单击 imageview 开始的位置,它确实会移动整个“面板”。为什么图像视图不与相对布局一起移动......至少就它的可点击性而言。实际图像在移动,但可点击的位置没有。
这是我的布局xml:
<RelativeLayout
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_width="fill_parent"
android:layout_height="120px"
android:layout_marginTop="-106px"
android:id="@+id/chatbox"
android:visibility="invisible">
<TextView
android:layout_width="fill_parent"
android:layout_height="106px"
android:background="#000000"
android:id="@+id/chattext" />
<ImageView
android:layout_width="20px"
android:layout_height="14px"
android:id="@+id/chatbubble"
android:layout_below="@id/chattext"
android:src="@drawable/chatbubble" />
</RelativeLayout>
编辑:我应该补充一点,我正在使用 Animation.setFillAfter(true) 在动画完成后将面板固定到位。