我正在制作动画,我有一个布局和列表视图,我将动画应用于从左到右的列表视图,它的工作正常但列表视图幻灯片前面的布局我想做从布局背面。
点击布局列表视图将从左向右滑动,它将位于布局旁边的位置,如下图所示。
感谢。
答案 0 :(得分:3)
尝试了解视图顺序(层次结构) 让我用一个例子说清楚
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<TextView
android:id="@+id/tvMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="dasdjfiuihuhds" />
<Button
android:id="@+id/btnOk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ok" />
</RelativeLayout>
这将使Textview通过ButtonView
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<Button
android:id="@+id/btnOk"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Ok" />
<TextView
android:id="@+id/tvMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="dasdjfiuihuhds" />
</RelativeLayout>
这将使Button over TextView
第一个案例代码
<RelativeLayout >
<TextView>
<Button>
第二案例代码
<RelativeLayout >
<Button>
<TextView>
简而言之,您可以通过遵循代码层次结构来维护订单