0

RecyclerView我在项目中有应用程序MaterialCardView。我看到,我的物品被切断了:

在此处输入图像描述

这是我的项目 xml 文件:

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools">

    <data>


    </data>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <com.google.android.material.card.MaterialCardView
            android:layout_width="match_parent"
            android:layout_height="46dp"
            android:layout_marginTop="6dp"
            android:layout_marginBottom="6dp"
            app:cardCornerRadius="5dp"
            app:cardElevation="0dp"
            app:strokeColor="@color/silver"
            app:strokeWidth="1dp">

            <EditText
                android:id="@+id/editText"
                android:textColor="@color/gray"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:layout_gravity="center"
                android:layout_marginLeft="23dp"
                android:layout_marginRight="23dp"
                android:textSize="14dp"
                android:textColorHint="@color/grey"
                android:background="@color/colorPrimary"
                android:gravity="center_vertical"
                android:hint="text here"
                android:singleLine="true"
                android:textDirection="rtl"
                tools:text="sfsdf s fs fs" />

        </com.google.android.material.card.MaterialCardView>

    </RelativeLayout>
</layout>

而且我不知道如何解决它。此问题并非在所有设备上重现,仅在三星上重现。我的应用程序处于 RTL 模式,也许问题与此有关。有没有办法解决它?

4

1 回答 1

0

这是最可能的问题来源。在您的代码中,有以下两个标签:

<data>
    </data>

你会尝试删除它们。似乎进入它们的内容与MateriallCardView

于 2021-06-24T13:31:04.753 回答