내 응용 프로그램 xml 레이아웃에서, 나는 선형 레이아웃이 두 개있는 Relativelayout을 가지고 있습니다. 이제는 두 레이아웃 모두에서 애니메이션을 만들고 있습니다. 그러나 thera가 다른 높이와 같아 보이기 때문에 나는 약간의보기 문제가있다.두 개의 다른 레이아웃을 동일한 높이로 만드는 방법은 무엇입니까?
그래서 두 레이아웃 모두 동일한 높이를 만들고 싶습니다. 아래 내 XML 파일입니다. 또는있는 LinearLayout로 변경 (당신이 엄격하게 필요하지 않은있는 LinearLayout 루트의 유일한 자식이기 때문에)
<!-- ============================================================= -->
<!-- BOTTLE/PEN LAYOUT -->
<!-- ============================================================= -->
<LinearLayout android:layout_height="wrap_content"
android:layout_width="fill_parent" >
<RelativeLayout android:layout_height="wrap_content"
android:layout_width="fill_parent">
<!-- ============================================================= -->
<!-- PEN LAYOUT -->
<!-- ============================================================= -->
<LinearLayout android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:id="@+id/pen_layout">
<TextView
android:text="EF"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:textColor="#000000"
android:layout_marginTop="2dp"
android:textSize="10sp"/>
<ImageView
android:id="@+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="@drawable/ink_pen"/>
<TextView
android:text="F"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:textColor="#000000"
android:layout_marginTop="2dp"
android:textSize="10sp"/>
<ImageView
android:id="@+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="@drawable/ink_pen"/>
<TextView
android:text="BOLD"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:textColor="#000000"
android:layout_marginTop="2dp"
android:textSize="10sp"/>
<ImageView
android:id="@+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="@drawable/ink_pen"/>
<TextView
android:text="ITALIC"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:textColor="#000000"
android:layout_marginTop="2dp"
android:textSize="10sp"/>
<ImageView
android:id="@+id/save"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:src="@drawable/ink_pen"/>
</LinearLayout>
<!-- ============================================================= -->
<!-- BOTTLE LAYOUT -->
<!-- ============================================================= -->
<LinearLayout android:orientation="vertical"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:weightSum="4"
android:id="@+id/bottle_layout">
<!-- First Row Bottle -->
<LinearLayout android:orientation="horizontal"
android:layout_height="wrap_content" android:layout_weight="1"
android:layout_width="fill_parent" android:weightSum="2">
<ImageView android:layout_height="wrap_content" android:layout_weight="1"
android:layout_width="wrap_content" android:src="@drawable/purple_bottle"/>
<ImageView android:layout_height="wrap_content" android:layout_weight="1"
android:layout_width="wrap_content" android:src="@drawable/red_bottle"/>
</LinearLayout>
<!-- Second Row Bottle -->
<LinearLayout android:orientation="horizontal"
android:layout_height="wrap_content" android:layout_weight="1"
android:layout_width="fill_parent" android:weightSum="2">
<ImageView android:layout_height="wrap_content" android:layout_weight="1"
android:layout_width="wrap_content" android:src="@drawable/gray_bottle"/>
<ImageView android:layout_height="wrap_content" android:layout_weight="1"
android:layout_width="wrap_content" android:src="@drawable/green_bottle"/>
</LinearLayout>
<!-- Third Row Bottle -->
<LinearLayout android:orientation="horizontal"
android:layout_height="wrap_content" android:layout_weight="1"
android:layout_width="fill_parent" android:weightSum="2">
<ImageView android:layout_height="wrap_content" android:layout_weight="1"
android:layout_width="wrap_content" android:src="@drawable/orange_bottle"/>
<ImageView android:layout_height="wrap_content" android:layout_weight="1"
android:layout_width="wrap_content" android:src="@drawable/blue_bottle"/>
</LinearLayout>
<!-- Forth Row Bottle -->
<LinearLayout android:orientation="horizontal"
android:layout_height="wrap_content" android:layout_weight="1"
android:layout_width="fill_parent" android:weightSum="2">
<ImageView android:layout_height="wrap_content" android:layout_weight="1"
android:layout_width="wrap_content" android:src="@drawable/black_bottle"/>
<ImageView android:layout_height="wrap_content" android:layout_weight="1"
android:layout_width="wrap_content" android:src="@drawable/white_bottle"/>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
을 사용하여 무게 각 아이의 layout_weight를 설정하는 것이 좋습니다. layout_height = '.5'둘 다에 대한 평등 한 높이를 얻을 것이다. –
질문과 관련이 없지만 펜 레이아웃에서 textView와 imageview를 함께 사용하는 대신 텍스트가있는 Button과 drawableLeft 또는 drawableRight 속성으로 설정된 이미지를 사용하는 것이 좋습니다. – Marmoy