0

RecycleView支架設定wrap_content爲什麼wrap_content沒有效果?

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

TextView文本不裹,還有很多的空白空間,在氣泡,裏面的TextView。

enter image description here

我怎麼能強迫看到這樣的事情在IOS版本:

enter image description here

在Android中使用9-patch形象background

+2

關閉袖口時,您的9貼片PNG太高。 9貼片PNG擴展但不縮小。文本寬度設置爲'match_parent',所以我假設你關心的是'wrap_content'高度上多餘的垂直空白。 – CommonsWare

+0

in TextView android:layout_width =「wrap_content」 並使用9-patch PNG – zombie

+0

TextView *不能小於9補丁。這是*最小尺寸*。 –

回答

1

您的文本視圖的高度是包裝和大尺寸監守你9patch圖像(可能有一個大尺寸)

的,這個寬度是匹配父母,你在XML layput通緝。

只要改變你的9補丁的大小,使寬度包裝內容太

0

調整您9patch。您還應該將RelativeLayout的高度和寬度更改爲wrap_content。或者,甚至更好,你應該刪除RelativeLayout(這似乎沒用)。

相關問題