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(这似乎没用)。

相关问题