如何让的ImageView和TextView的高度相同 [英] How to let the ImageView and the TextView the same height
本文介绍了如何让的ImageView和TextView的高度相同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的布局有ImageView的(iv)和TextView的(电视)。 我想让IV的电视权利。 与电视机的高度是一样的IV的。 电视机重力设置为CENTER_VERTICAL。
My layout have ImageView(iv) and TextView(tv). I want to let the tv right of iv. And the tv's height is same as iv's. The tv Gravity set as CENTER_VERTICAL.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"/>
<TextView
android:id="@+id/tv"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/iv"
android:text="TextView" android:gravity="center_vertical"/>
</RelativeLayout>
如何到达目标?
How to arrive the goal?
推荐答案
喜试试这个......
hi try this .....
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/iv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:src="@drawable/ic_title_home_demo" />
<TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignBottom="@+id/iv"
android:layout_alignTop="@+id/iv"
android:layout_toRightOf="@+id/iv"
android:gravity="center_vertical"
android:text="TextView" />
</RelativeLayout>
这篇关于如何让的ImageView和TextView的高度相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文