내 레이아웃에는 ImageView (iv)와 TextView (tv)가 있습니다. 나는 iv의 tv 권리를시키고 싶다. 그리고 tv의 높이는 iv와 같습니다. tv Gravity가 CENTER_VERTICAL로 설정되었습니다.ImageView와 TextView의 높이를 같게하는 방법
<?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>
목표를 달성하는 방법?
당신의 LinearLayout를 사용할 수 RelativeLayout 대신 layout_weight 매개 변수를 ImageView와 TextView에 모두 1로 사용할 수 있습니다. –
두 높이가 같은 위젯을 어떻게 얻을 수 있습니까? 텍스트 뷰의 높이는 텍스트 크기에 따라 다릅니다. 우리는 나란히 서서 갈 수 있습니다. 우리는 같은 높이를 보장 할 수 없습니다. –