我的情况是:我有 2 个布局 A 和 B,A 在顶部,B 在底部,例如
----------------
- -
-LinearLayout A-
- -
--------------- -
- -
-RelativeLayout B-
- -
--------------- -
我在 RelativeLayout B 中创建了一个 ImageView C,并设置了一个触摸,以便 C 可以在 B 中移动。但是当 C 在 A 和 B 的边缘移动时,ImageView C 被 A 剪切,只有 C 的下半部分显示在 B 上。
我的问题是:当 C 在 A 和 B 的边缘移动时,我如何显示它的上部?
您可以做到这一点的一种方法是创建第三个全屏布局 C,叠加在上面描述的两个布局上。 然后,在 C 中拖动。
<FrameLayout -- this is your top level layout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout>
<LinearLayout ... /> -- A
<LinearLayout ... /> -- B
</LinearLayout>
<View -- this is the full screen view
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@null" > -- null background makes it transparent
</View>
</FrameLayout>