0

Set wrap_content in RecycleView holder:

<?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="match_parent"
    android:background="@android:color/black">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/textView3"
        android:textColor="@android:color/white"
        android:textSize="17dp"
        android:background="@drawable/bubbleblue170x140_2" />

</RelativeLayout>

But text in TextView is not wrapped, there is a lot of empty space in the bubble, inside TextView.

enter image description here

How can I force to see something like this in iOS version:

enter image description here

In Android using 9-patch image as background.

János
  • 32,867
  • 38
  • 193
  • 353
  • 2
    Off the cuff, your 9-patch PNG is too tall. 9-patch PNGs expand but do not shrink. The text width is set to `match_parent`, so I assume your concern is the extra vertical whitespace on the `wrap_content` height. – CommonsWare Oct 11 '16 at 21:19
  • in TextView android:layout_width="wrap_content" and use 9-patch PNG – zombie Oct 11 '16 at 21:24
  • The TextView *can't be smaller* than the 9 patch. That's the *minimum size*. – Phantômaxx Oct 11 '16 at 21:35

2 Answers2

1

The height of your text view is wrap and the big size is becuase of your 9patch image (probably having a big size)

And the width of that is match parent as you wanted in xml layput.

Just change the size of your 9 patch and make the width wrap content too

Amir Ziarati
  • 14,248
  • 11
  • 47
  • 52
0

Resize your 9patch. You should also change the RelativeLayout's height and width to wrap_content. Or, even better, you should remove the RelativeLayout (it seems useless).

rmgoncalo
  • 567
  • 6
  • 16