2011-04-29 5 views
0

enter image description here 친구, 내가 레이아웃 코드 및 버튼 다음 작성한안드로이드 레이아웃 체중 문제

동일하게 화면에 표시 할 수 있지만하지 하나가 내가 뭐하는 거지 실수로 나를 인도 작동하는 것 같다?

![<?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="fill_parent" 
> 

    <LinearLayout 
    android:layout_alignParentTop="true" 
    android:layout_centerHorizontal="true" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:background="@color/color_panel_background" 
    > 

     <ImageButton 
     android:layout_height="wrap_content" 
     android:id="@+id/currentLocation" 
     android:layout_weight="1" 
     android:layout_width="fill_parent" 
     android:src="@drawable/current_location_icon" 
     /> 

     <ImageButton 
     android:layout_height="wrap_content" 
     android:id="@+id/searchCity" 
     android:layout_weight="1" 
     android:layout_width="fill_parent" 
     android:src="@drawable/search_icon" 
     /> 

     <ImageButton 
     android:layout_height="wrap_content" 
     android:id="@+id/home" 
     android:layout_weight="1" 
     android:layout_width="fill_parent" 
     android:src="@drawable/home_icon" 
     /> 

    </LinearLayout> 

</RelativeLayout>][2] 

답변

0

가운데 단추의 드로어 블이 다른 두 단추보다 분명히 큽니다. wrap_content를 사용하여 단추의 높이를 설정하면 중간 단추가 커집니다. 무게는 이것과 관련이 없습니다. fill_parent를 사용할 때 아이템이 얼마나 많은 공간을 차지하는지를 정의합니다. 가장 쉬운 방법은 layout_height를 고정 값 (dp 단위로 사용) 으로 변경하거나 드로어 블의 크기를 변경하여 이미지를 모두 동일한 크기로 만드는 것입니다.

질문에 대한 질문에 대한 답변입니다. 스크린 샷 및 관련 코드. 모두가

0

"wrap_content"에서 당신이 그 (것)들을 동일한 높이를 갖고 싶어 몇 가지 상수로 변경 android:layout_height.

0

변화가 선형 레이아웃 내에서 일부 일정 및 변화 오브젝트 layout_height로 선형 레이아웃 높이가 수평에서

0

를 fill_parent하는 :) 그렇게 할 것입니다 소원 : 당신이 다음 = 0dp 설정 아이 뷰에 대한 무게를 설정하는 경우 Vertical에서 : 하위보기의 가중치를 설정 한 다음 height = 0dp로 설정하면

관련 문제