我有两张卡片视图,我想把一张放在另一张上面,但最终的结果是,它们是放在一起的:

这是XML代码:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="@+id/entryTypeCardView"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Spinner
android:id="@+id/entryChoiceSpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp" />
</android.support.v7.widget.CardView>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
android:id="@+id/currencySpinnerLayout"
android:orientation="vertical"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:id="@+id/currencyTypeCardView"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Spinner
android:id="@+id/currencyChoiceSpinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="10dp" />
</android.support.v7.widget.CardView>
</RelativeLayout>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent">
<AutoCompleteTextView
android:id="@+id/personNameTextField"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
...我做错了什么?
发布于 2015-07-01 10:40:36
为第一个RelativeLayout分配一些id
<RelativeLayout
android:id="@+id/first_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content">然后用
android:layout_below="@+id/first_layout"到第二个布局。
https://stackoverflow.com/questions/31158930
复制相似问题