János
János

Reputation: 35040

Why wrap_content has no effect?

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.

Upvotes: 0

Views: 426

Answers (2)

rmgoncalo
rmgoncalo

Reputation: 587

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).

Upvotes: 0

Amir Ziarati
Amir Ziarati

Reputation: 15087

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

Upvotes: 1

Related Questions