C# xamarin卡视图布局

C# xamarin卡视图布局,c#,xamarin,xamarin.android,C#,Xamarin,Xamarin.android,我正在尝试重新创建一个类似于此的cardview,上面有一个标题的图像,然后是一些数据,下面可能还有一些操作按钮。但就我个人而言,我无法将文本置于图像之上。 这是我到目前为止所拥有的 <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cardview

我正在尝试重新创建一个类似于此的cardview,上面有一个标题的图像,然后是一些数据,下面可能还有一些操作按钮。但就我个人而言,我无法将文本置于图像之上。

这是我到目前为止所拥有的

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:cardview="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="325dp"
android:layout_margin="8dp">
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <ImageView
        android:id="@+id/image1"
        android:layout_width="match_parent"
        android:layout_height="230dp"
        android:layout_alignParentTop="true"
        android:scaleType="centerCrop" />
    <TextView
        android:id="@+id/recipeName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/image1"
        android:maxLines="3"
        android:padding="8dp"
        android:text="name"
        android:textColor="#222"
        android:textStyle="bold"
        android:textSize="22dp" />
    <TextView
        android:id="@+id/description"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/recipeName"
        android:maxLines="3"
        android:padding="8dp"
        android:text="description"
        android:textColor="#666"
        android:textSize="14dp" />
    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:layout_below="@+id/description">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/recipeName"
            android:maxLines="3"
            android:padding="8dp"
            android:text="View"
            android:textColor="#666"
            android:textSize="14dp" />
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@+id/recipeName"
            android:maxLines="3"
            android:padding="8dp"
            android:text="Add"
            android:textColor="#666"
            android:textSize="14dp" />
    </LinearLayout>
</RelativeLayout>


我假设您希望在
@+id/image1
之上添加
@+id/recipeName

recipeName
上,您设置了:
android:layout_below=“@+id/image1”
,它将在
image1
下面布局元素。删除该行,因为您不希望它位于该元素下方。试试android:layout\u alignBottom=“@+id/image1”。有足够的布局参数来做大多数事情:,但一旦你开始做复杂的布局,它可能有点像兔子洞


此外,在
LinearLayout
中的元素下方有
layout\u,它不会起任何作用。

您是指textview的层吗?你能从你的应用程序中给我们截图以获得更好的印象吗?是的,尝试在图片底部获得配方名称。我将查看您提到的各种布局参数。谢谢你,伙计。