1

I have a ListView that contains many item. Items are RelativeLayout like this :

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="match_parent"
            android:layout_height="100dp"
            android:background="@android:color/white">

    ...
    ...
    ...

    <TextView
        android:id="@+id/tvDescriptionDetailConnect"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/ivImageDetailConnect"
        android:layout_below="@id/tvTypeDetailConnect"
        android:layout_toEndOf="@+id/ivImageDetailConnect"
        android:ellipsize="end"
        android:layout_gravity="fill"
        android:baselineAligned="false"
        android:includeFontPadding="false"
        android:layout_marginEnd="5dp"
        android:text="New Text"
        android:textColor="@color/colorDarkGray"
        android:textSize="12sp"/>

</RelativeLayout>

But the TextView tvDescriptionDetailConnect is cut off at the bottom when size font settings is too large. Why ?

enter image description here

BSK-Team
  • 1,750
  • 1
  • 19
  • 37
  • 1
    Because the height of its parent RelativeLayout is fixed. Make it wrap_content and it should work. – Praveen Singh Jan 23 '18 at 15:10
  • I need to fix height of RelativeLayout to 100dp. I just want to hide the cut line. And even with wrap_content, the line is cut. – BSK-Team Jan 23 '18 at 15:11

3 Answers3

0

Since the contents of Relative Layout height is more than 100dp.Replace the Relative layout height from 100dp to wrap_content. Which will provide the height for the as much as they required.

android:layout_height="wrap_content"

Er Prajesh
  • 61
  • 1
  • 5
0

You can ellipsize the text to avoid cutting off your text or you can change the height to wrap_content and use a minimunHeight of 100dp

Jose Riballo
  • 308
  • 2
  • 12
0

Give match_parent as height to TextView and then use ellipsize the text to avoid cutting off your text