Android 随着文本大小的增加而增加版面长度(多行)

Android 随着文本大小的增加而增加版面长度(多行),android,android-layout,android-linearlayout,textview,android-relativelayout,Android,Android Layout,Android Linearlayout,Textview,Android Relativelayout,我想随着aa长度的增加增加绿线的高度(假设aa是7线附近的多行,那么绿线应该自动增加), 我已经尝试了我的努力,但失败了,现在我没有更多的想法来实现上述内容,下面是我对上述布局的xml //My root layout, which/who contain all the two child layouts(relative and linear layout) <RelativeLayout android:layout_width="match_parent"

我想随着aa长度的增加增加绿线的高度(假设aa是7线附近的多行,那么绿线应该自动增加), 我已经尝试了我的努力,但失败了,现在我没有更多的想法来实现上述内容,下面是我对上述布局的xml

//My root layout, which/who contain all the two child layouts(relative and linear layout)
<RelativeLayout android:layout_width="match_parent"
                android:layout_height="wrap_content">

   //Layout for image and line, here i want to increase the height of "profile_view_line(green line)" with increase in size of text "profile_tv_descriptionName"
    <RelativeLayout android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:id="@+id/profile_layout_relDescription">

        //This is the imageview,whose background is tranparent, so if i remove "layout below " property from "profile_view_line", then "profile_view_line" 
        //appear behind imageview(profile_img_description),which must/should not happen, but here i fail as well (as i don't want to appear this behind imageview)
        <ImageView android:id="@+id/profile_img_description"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:src="@drawable/description_icon"
            android:layout_alignParentLeft="true"/>

            //This is the line to be expanded with increase in size of "profile_tv_descriptionName" but with minimum size of 30dp as height 
            //and must grow with the "profile_tv_descriptionName" if (profile_tv_descriptionName) is multi-line

            //i can't set property depending on "profile_tv_descriptionName"
            as it is in another viewgroup(relativeayout), due to which i can't set property on this one
        <View android:layout_below="@id/profile_img_description"
            android:layout_width="@dimen/1dp"
            android:id="@+id/profile_view_line"
            android:layout_height="@dimen/30dp"
            android:background="@color/colorGreen"
            android:layout_centerHorizontal="true" />
     </RelativeLayout>

     //Layout for description title and description text "aa" which exapnds as expected, here the dependincy is based on above maintained relative layout "profile_layout_relDescription"
    <LinearLayout android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical"
                android:layout_toRightOf="@id/profile_layout_relDescription"
                android:layout_alignBottom="@id/profile_layout_relDescription">

        //This is the title, useless in this case but need for appearance
        <TextView
            android:id="@+id/profile_tv_description"
            android:text="@string/profile_description"
            android:textSize="@dimen/8dp"
            android:gravity="left"/>

         //this is the dependency factor which can increase and according to which "profile_view_line" green line must expand but i can't do 
         //that because it is in another viewgroup(linearlayout), due to which i can't set property on this one
        <TextView
            android:layout_height="wrap_content"
            android:id="@+id/profile_tv_descriptionName"
            android:text="Vikram"
            android:textSize="@dimen/13dp"
            android:gravity="left"/>
      </LinearLayout>
</RelativeLayout>
//我的根布局,其中/谁包含所有两个子布局(相对布局和线性布局)
//图像和线条的布局,这里我想随着文本“profile\u tv\u descriptionName”大小的增加而增加“profile\u view\u line(绿线)”的高度
//这是imageview,其背景是tranparent,因此,如果我从“纵断面图”中删除“layout below”属性,则为“纵断面图”
//出现在imageview(配置文件\u img\u描述)后面,这必须/不应该发生,但在这里我也失败了(因为我不想出现在imageview后面)
//这条线将随着“profile\u tv\u descriptionName”尺寸的增加而扩展,但最小尺寸为30dp作为高度
//如果(profile\u tv\u descriptionName)是多行的,则必须使用“profile\u tv\u descriptionName”进行扩展
//无法根据“profile\u tv\u descriptionName”设置属性
由于它位于另一个视图组(relativeayout)中,因此我无法在此视图组上设置属性
//描述标题和描述文本“aa”的布局如预期所示,此处的相关性基于上述维护的相对布局“纵断面\布局\相关描述”
//这是标题,在本例中无用,但需要外观
//这是可以增加的依赖因子,根据它,“纵断面图”绿线必须展开,但我不能这样做
//这是因为它位于另一个视图组(linearlayout)中,因此我无法在此视图组上设置属性

尝试如下布局:

<LinearLayout, horizontal>
    <LinearLayout, vertical, width wrap_content, height match_parent, gravity center_horizontal>
        <ImageView set width, set height>
        <View, greeen line, height 0, weight 1>
    </LinearLayout>
    <LinearLayout, vertical, width 0, height wrap_content, weight 1>
        <TextView title, wrap_content>
        <TextView description, wrap_content>
    </LinearLayout>
</LinearLayout>
其中A是图像,B是标题,C是行,D是文本

B和D需要彼此垂直对齐,紧靠着A和C,这对我来说,每一对都应该是垂直线性布局,然后这两对应该在水平布局中对齐,使它们对齐

A和C的宽度与A相同,但其他两个需要占用剩余空间。这意味着宽度为0,重量为1

现在我们有:

A B----------------------
C D----------------------
现在我们需要处理身高问题。A有固定的高度。B和D有一个固定的高度,由其中的文本定义。这使得C具有可变的高度,占据了剩余的空间。所以我们说AC的高度与父项匹配,然后由BD的高度定义。然后C的高度为0,重量为1,使其填充所有剩余的高度。这给了我们:

A B----------------------
C D----------------------
- -----------------------

感谢您的快速回复,但我没有看到绿线,我必须与描述一起增长,我还需要imageview,它不是9patch(简单png)@但现在绿线视图是Endlies,这会生成其他视图(不在图片中)不显示在布局中您给外部线性布局的高度是多少?linearlayout是匹配父级,并且位于另一个布局嵌套ScrollView(匹配父级)将线性布局更改为换行内容
A B----------------------
C D----------------------
- -----------------------