首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CardView布局重叠

CardView布局重叠
EN

Stack Overflow用户
提问于 2015-07-01 10:36:38
回答 1查看 2.2K关注 0票数 1

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

这是XML代码:

代码语言:javascript
复制
<?xml version="1.0" encoding="utf-8"?>

代码语言:javascript
复制
<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"
      ...

我做错了什么?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-07-01 10:40:36

为第一个RelativeLayout分配一些id

代码语言:javascript
复制
<RelativeLayout
android:id="@+id/first_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content">

然后用

代码语言:javascript
复制
android:layout_below="@+id/first_layout"

到第二个布局。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31158930

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档