【发布时间】:2019-10-01 21:40:51
【问题描述】:
我将 CardView 用于 recycleView android CardView 包含(ImageView 和许多 TextView) 我想在 ImageView android xml 上放置许多 textView
1 - 图像视图的中心(没问题)
2 - 右下
3 - 左下
4 - 右上角
5 - 左上角
这里是回收视图的xml项 TextView 在 ImageView 的中心,但我不能放在其他 4 个位置
像这样: this image for place TextView in center of imageView and what I need to do
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
card_view:cardCornerRadius="8dp"
card_view:cardUseCompatPadding="true">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/stadium_photo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_alignParentTop="true"
android:layout_marginStart="0dp"
android:layout_marginTop="0dp"
android:scaleType="centerCrop"
android:src="@drawable/ic_stadium" />
<TextView
android:id="@+id/stadium_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:text="Mohammad"
android:textColor="#ffffcd"
android:textSize="40sp"
android:textStyle="bold" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
【问题讨论】:
标签: android xml android-layout android-imageview