Android 相对布局中的布局单元赢得';不显示
我试图在相对布局中的cardview下方制作一个布局,但它不会显示在我的设备中,上面的布局可以工作。我不知道为什么它不起作用。我认为这应该是工作,因为它低于cardview。请帮助我,我错过了什么或错了什么 这是我的xml代码Android 相对布局中的布局单元赢得';不显示,android,android-layout,Android,Android Layout,我试图在相对布局中的cardview下方制作一个布局,但它不会显示在我的设备中,上面的布局可以工作。我不知道为什么它不起作用。我认为这应该是工作,因为它低于cardview。请帮助我,我错过了什么或错了什么 这是我的xml代码 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" and
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background_2"
tools:context=".ExchangeFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/saldo"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:src="@drawable/holder" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:gravity="center_horizontal"
android:text="Will Stitch"
android:textSize="15dp"
android:textStyle="bold" />
</LinearLayout>
<android.support.v7.widget.CardView
android:id="@+id/saldo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:layout_margin="20dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center"
android:text="Saldo"
android:textColor="@color/colorPrimary"
android:textSize="20dp"
android:textStyle="bold" />
</android.support.v7.widget.CardView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/saldo"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="WillStitch@gmail.com"
android:textSize="10dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
请解释为什么它是这样的它正在工作,但您的
图像视图
占据了所有宽度,并且它没有android:src
属性(因此它不显示任何内容),并且您不需要最后的线性布局:
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/saldo"
android:orientation="vertical">
<!-- Useless Linear Layout -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp"
android:text="WillStitch@gmail.com"
android:textSize="10dp"
android:textStyle="bold" />
</LinearLayout>
</LinearLayout>
到底是什么不起作用?你能分享一个截图吗?似乎您没有将
android:src
属性添加到下面的ImageView
,这是故意的吗?