Java Android布局-两个属性相似的相对布局,但第二个更大

Java Android布局-两个属性相似的相对布局,但第二个更大,java,android,xml,layout,Java,Android,Xml,Layout,这让我有点困惑,我似乎无法理解 我正在创建一个聊天界面,在自定义适配器中具有并排相对布局 <?xml version="1.0" encoding="UTF-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="?android:attr/listPreferr

这让我有点困惑,我似乎无法理解

我正在创建一个聊天界面,在自定义适配器中具有并排相对布局

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="?android:attr/listPreferredItemHeight"
android:padding="6dip">

<LinearLayout
    android:orientation="horizontal"
    android:layout_width="wrap_content"
    android:layout_weight="1" android:layout_height="wrap_content">
    <RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="wrap_content" android:layout_weight="1" android:layout_height="wrap_content">
        <TextView android:id="@+id/lefttext" android:text="TextView" android:layout_width="fill_parent" android:gravity="top" android:layout_height="wrap_content" android:paddingLeft="10dip" android:paddingRight="10dip" android:paddingTop="5dip" android:layout_alignParentLeft="true"></TextView>
    </RelativeLayout>
    <RelativeLayout android:id="@+id/relativeLayout2" android:layout_width="wrap_content" android:layout_weight="1" android:layout_height="wrap_content">
        <TextView android:id="@+id/righttext" android:layout_width="fill_parent" android:text="TextView" android:layout_height="wrap_content" android:paddingLeft="10dip" android:paddingRight="10dip" android:paddingTop="5dip" android:layout_alignParentLeft="true" android:layout_alignParentTop="true"></TextView>
    </RelativeLayout>
</LinearLayout>

有什么想法吗?

试着从右侧
文本视图
中删除
布局。如果不是这样的话,你的背景是9-patches吗?你确定你的9-补丁被正确地拉伸了吗?

哇,最后是9-补丁的图像。谢谢杰出的它们很强大,但如果你不小心的话,可能会导致头部抓伤。
            if (wasMine == 0) 
            {
                lt.setText(Message);
                leftLayout.setBackgroundResource(R.drawable.speechbubblefrom);
                rightLayout.setBackgroundDrawable(null);
                rt.setText(""); 

            }
            else if (wasMine == 1)
            {
                rt.setText(Message);
                rightLayout.setBackgroundResource(R.drawable.speechbubbleto);
                leftLayout.setBackgroundDrawable(null);
                lt.setText("");
            }