我正在使用如下表格布局:
<TableLayout android:layout_height="wrap_content"
android:layout_width="fill_parent" android:stretchColumns="1" >
<TableRow android:layout_marginTop="2dp">
<TextView android:text="Email Id" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_marginBottom="5dp"
android:layout_marginLeft="3dp" android:textStyle="bold"
android:textSize="16sp" android:textColor="#000000"
android:layout_weight="2"
android:background="#e0f7fd"/>
<TextView android:text="abcedfgh.jklmn@gmail.com"
android:layout_width="0dp" android:layout_height="wrap_content"
android:textColor="#000000" android:layout_marginBottom="5dp"
android:layout_weight="2" android:textSize="15sp"
android:layout_marginLeft="3dp"/>
</TableRow>
</TableLayout>
文本“abcedfgh.jklmn@gmail.com”出现在多行中。我必须根据“abcedfgh.jklmn@gmail.com”文本封面的行数将背景颜色设置为 textview“Email Id”。
例如:如果文本“abcedfgh.jklmn@gmail.com”有两行,我必须将背景颜色设置为两行高度的 textview“Email Id”。