嗨,我是Android/XML的新手,我试图在材料卡片视图中创建相对布局,但是相对布局结束标签给了我错误的“关闭这个标签的错误方式”,并说用相对布局替换材料卡片视图。
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
<ImageView
android:layout_width="120dp"
android:layout_height="170dp"
android:id="@+id/bookimg"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:src="@mipmap/ic_launcher"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/booktitle"
android:text="Book Title"
android:textSize="20sp"
android:textColor="@color/white"
android:textStyle="bold"/>
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>发布于 2022-08-15 06:57:01
一定是这样的
<com.google.android.material.card.MaterialCardView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="120dp"
android:layout_height="170dp"
android:id="@+id/bookimg"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:src="@mipmap/ic_launcher"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/booktitle"
android:text="Book Title"
android:textSize="20sp"
android:textColor="@color/white"
android:textStyle="bold"/>
</RelativeLayout>
</com.google.android.material.card.MaterialCardView>https://stackoverflow.com/questions/73357519
复制相似问题