Alex D.
Alex D.

Reputation: 1423

MaterialCardView is cutted off in RecyclerView in RTL mode

I have application with RecyclerView and MaterialCardView in the items. And I see, that my items are cutted off:

enter image description here

Here is my items xml file:

<?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>

And I dont know how to fix it. This issue reproduces not on all devices, for me only on Samsung. And my Application is in RTL mode, maybe the issue is related to this. Is there a way how to fix it?

Upvotes: 0

Views: 81

Answers (1)

Bro Nicholas
Bro Nicholas

Reputation: 223

This is the most probable source of problems. In your code, there are these two tags:

<data>
    </data>

Would you try removing them. Seems like the content going into them is overlapping the MateriallCardView

Upvotes: 0

Related Questions