左右侧background都用9png,先定义左侧布局,因右侧布局尚未定义则这里指定按右侧高度对齐,所以后面id前面需要+号,如下:

android:layout_alignBottom="@+id/layout_right"

android:layout_alignTop="@+id/layout_right"

右侧:

android:layout_toRightOf="@id/layout_left"


<?xml version="1.0" encoding="utf-8"?><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"    android:layout_width="fill_parent"    android:layout_height="wrap_content"    android:orientation="horizontal" >    <RelativeLayout        android:id="@+id/layout_left"        android:layout_width="57dp"        android:layout_height="wrap_content"        android:layout_alignBottom="@+id/layout_right"        android:layout_alignTop="@+id/layout_right"        android:background="@drawable/tip_bg_left" >    </RelativeLayout>    <RelativeLayout        android:id="@+id/layout_right"        android:layout_width="fill_parent"        android:layout_height="wrap_content"        android:layout_gravity="center_vertical"        android:layout_toRightOf="@id/layout_left"        android:background="@drawable/tip_bg_right" >        <LinearLayout            android:id="@+id/layout_text"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_alignParentLeft="true"            android:layout_centerVertical="true"            android:gravity="center_vertical"            android:orientation="vertical"            android:paddingBottom="24dp"            android:paddingLeft="20dp"            android:paddingRight="20dp"            android:paddingTop="24dp" >            <LinearLayout                android:id="@+id/textGroup1"                android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:orientation="horizontal" >                <TextView                    android:layout_width="wrap_content"                    android:layout_height="wrap_content"                    android:text="1."                    android:textColor="@color/alarm_txt_gray" />                <TextView                    android:id="@+id/text1"                    android:layout_width="wrap_content"                    android:layout_height="wrap_content"                    android:text="111111111111222222222222"                    android:textColor="#000000" />            </LinearLayout>            <LinearLayout                android:id="@+id/textGroup2"                android:layout_width="wrap_content"                android:layout_height="wrap_content"                android:orientation="horizontal" >                <TextView                    android:layout_width="wrap_content"                    android:layout_height="wrap_content"                    android:text="2."                    android:textColor="@color/alarm_txt_gray" />                <TextView                    android:id="@+id/text2"                    android:layout_width="wrap_content"                    android:layout_height="wrap_content"                    android:text="2222222222222"                    android:textColor="#000000" />            </LinearLayout>        </LinearLayout>    </RelativeLayout></RelativeLayout>


效果如下:

android布局时,左侧宽度固定而右侧textview高度变化,怎么9png实现左侧高度与右侧相等?_第1张图片

android布局时,左侧宽度固定而右侧textview高度变化,怎么9png实现左侧高度与右侧相等?_第2张图片

更多相关文章

  1. Android 布局文件属性讲解
  2. ANDROID L——Material Design详解(主题和布局)
  3. android中shape布局详解
  4. Android ImageView设置长度高度为wrap_content时高度根据图片比
  5. android编辑布局文件时非要降低api level或者更改主题才能显示布
  6. Android 线性布局:LinearLayout
  7. Android学习笔记-Android非布局activity中布局文件及控件加载方

随机推荐

  1. 一些下载交叉编译环境的地址
  2. 近 100 个 Linux 常用命令大全
  3. linux清空日志文件内容 比如log日志
  4. video4linux(v4l)使用摄像头的实例基础教
  5. BULLSEYE:没有覆盖linux中的共享库
  6. Linux - Nginx配置反向代理。
  7. windows linux 创建oracle用户及表空间
  8. 压缩解压常用命令
  9. mysql数据库忘记ROOT密码时的解决办法
  10. Linux Bash Shell编程快速入门