Why is the text in the text view cut off in the recycler view?

android textview cut off right
android:text cut off
textview cutting off a letter in android
android textview wrap text multiple lines
textview gets cut off android
android-spinner text cut off
android textview text fill width
textview cut last line

I'm trying to make an items with just an image and a title below it in a recycler view. For some reason my text view's that hold the title are getting cut off on the bottom.

See below:

I've tried setting the text view height to wrap_content but that will result in my images being pushed up and not consistently the same size across all items. Also I find it odd that the text view size & positioning doesn't even match the preview layout in android studios.

Any suggestions?

My view holder layout:

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

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="4dp"
        android:background="@drawable/thumbnail_frame"
        android:paddingLeft="16dp"
        android:paddingTop="12dp"
        android:paddingRight="16dp"
        android:paddingBottom="12dp">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:orientation="vertical"
            android:weightSum="100"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintDimensionRatio="5:4"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent">

            <ImageView
                android:id="@+id/thumbnail_item"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="80"
                android:background="@color/dark_red"
                android:scaleType="centerCrop" />

            <TextView
                android:id="@+id/thumbnail_title"
                android:layout_width="match_parent"
                android:layout_height="0dp"
                android:layout_weight="20"
                android:ellipsize="end"
                android:maxLines="2"
                android:padding="8dp"
                android:text="@string/title_place_holder"
                android:textColor="@color/white"
                android:textSize="12sp" />

        </LinearLayout>

    </androidx.constraintlayout.widget.ConstraintLayout>
</layout>

Why did you created a linear layout inside a constraint layout?

You can remove linear layout an put your ImageView and TextView directly inside constraint layout and constraint TextView top to bottom of ImageView

and instead of using weight you can use layout_constraintHeight_percent just like below:

app:layout_constraintHeight_percent="0.2"

But I recommend you not to use height_percant or weight and also avoid sizing the views width/height statically. it can cause problems on different screens

I think its better to remove LinearLayout and also remove weight and add this line to your ImageView:

app:layout_constraintDimensionRatio="H,5:4"

Write your TextView and ImageView like below:

<androidx.constraintlayout.widget.ConstraintLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_margin="4dp"
    android:background="@drawable/thumbnail_frame"
    android:paddingLeft="16dp"
    android:paddingTop="12dp"
    android:paddingRight="16dp"
    android:paddingBottom="12dp">

        <ImageView
            android:id="@+id/thumbnail_item"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:background="@color/dark_red"
            android:scaleType="centerCrop"
            app:layout_constraintDimensionRatio="H,5:4"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent" />

        <TextView
            android:id="@+id/thumbnail_title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ellipsize="end"
            android:maxLines="2"
            android:padding="8dp"
            android:text="@string/title_place_holder"
            android:textColor="@color/white"
            android:textSize="12sp" 
            app:layout_constraintTop_toBottomOf="@id/thumbnail_item"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"/>

</androidx.constraintlayout.widget.ConstraintLayout>

Android: Last line of textview cut off, I've encountered the same cut-off issue as shown at the screenshot. It is caused by the I think the text view is not calculated correctly because of the sibling view , Spinner. addOnGlobalLayoutListener does not work in a recycler view. 4.2.2 4.3 abc Action Bar AlertDialog Android Android 4.4 Android 5.0 Android apk Android Desktop OS Apps BBM Free Download Genymotion Google Play Google Play Services Hack KitKat kotlin Linux ListView load image login register login register authentication material design mongodb nodejs opencv Python Raspberry Pi recycler view retrofit rxjava


I believe I have found the problem and it's the weight you're using in your LinearLayout. Depending on the ImageView height (80) you have determined TextView height (20). Because of that TextView cannot wrap, so text is being cut from the bottom.

Solution 1: remove weight in linear layout and set image height to fixed height, and TextView to wrap_content. Just like below:

<LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintDimensionRatio="5:4"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <ImageView
            android:id="@+id/thumbnail_item"
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:background="@color/dark_red"
            android:scaleType="centerCrop" />

        <TextView
            android:id="@+id/thumbnail_title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ellipsize="end"
            android:maxLines="2"
            android:padding="8dp"
            android:text="@string/title_place_holder"
            android:textColor="@color/white"
            android:textSize="12sp" />
    </LinearLayout>

Solution 2: You can remove padding in the TextView or set it to smaller one, but the problem might reoccur on smaller screens.

TextView text rendering problem, Hope I'm using Flexbox correctly, but I occasionally see TextView within a Flexbox render text incorrectly. Samsung S6; OS 5.1.1 Emulator; OS� Because of that TextView cannot wrap, so text is being cut from the bottom. Solution 1: remove weight in linear layout and set image height to fixed height, and TextView to wrap_content. Just like below:


Make the weight of imageview to 60 and the weight of textview to 40. In short keep adjusting the weight attr value in order to solve your problem. Use thia solution only when you really need weight attr in your code. Or else, just remove weight and set the height to wrap_content for both of them.

When you see cutoff at the bottom of your textview, Not a question but FYI,. If such situation happens, just change android: layout_width part in your text view parenthesis to "wrap_content". The recycler view is one of the most versatile and useful views in Android development. It can essentially form the backbone of an entire UI. Recycler view is similar to a list, but rather than


RecyclerView cutting off sides of CardView, RecyclerView cutting off sides of CardView - android. To make your text center, change TextView width to match_parent <RelativeLayout� Touch events, like clicking should be handled by the views in the recycler view. If the view should trigger something in the object in which it is used (activity or fragment), you can pass via the constructor of the adapter to it. This allows the adapter to store a reference to the object and call its methods for feedback.


layout Android: Last line of textview cut off?, I've encountered the same cut-off issue as shown at the screenshot. TextView and Spinner have different baselines due to font size difference. add a dummy View of desired height (i.e. this will add padding itself) at the bottom of your view. The view holder objects are managed by an adapter, which you create by extending RecyclerView.Adapter. The adapter creates view holders as needed. The adapter also binds the view holders to their data. It does this by assigning the view holder to a position, and calling the adapter's onBindViewHolder() method. That method uses the view holder's


RecyclerView cutting off last item, recyclerview wrap_content not showing all items android:text="name" android: textColor="@android:color/white"/> <TextView android:id="@+id/total_view"� RecyclerView Tutorial With Example In Android Studio. In Android, RecyclerView is an advanced and flexible version of ListView and GridView. It is a container used for displaying large amount of data sets that can be scrolled very efficiently by maintaining a limited number of views.