2014-01-16 6 views
0

나는 환경 설정 활동에서 두 가지 환경 설정을 나란히하고 싶습니다. Nebulander나란히 나란히 안드로이드

내가 시도 :

imagepref2.xml :

image

이 벽지에서 가져온 : 예는 이것이다

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:orientation="horizontal" 
    android:paddingBottom="15dip" 
    android:paddingTop="15dip" > 

    <ImageView 
     android:id="@+id/thumb_1" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:layout_weight="1" 
     android:src="@drawable/img_1" /> 

    <ImageView 
     android:id="@+id/thumb_2" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_gravity="center" 
     android:layout_weight="1" 
     android:src="@drawable/img_2" > 
    </ImageView> 
</LinearLayout> 

그러나 이것은 표시 등 : this

+0

레이아웃에 어떤 문제가 있는지 더 설명해 주시겠습니까? 결과가 레이아웃 XML에서 정의한 것과 정확히 일치한다고 생각합니다. – nKn

답변

0

내 생각에 너의 android:layout_weight="1"이 1 이니까. 0.5로 변경하십시오. 변경하기 android:layout_width="wrap_content"android:layout_width="0dp"

+1

'LinearLayout'에 정의 된 'weightSum' 속성이 없기 때문에이 경우 layout_weight가 1 또는 0.5이면 아무런 문제가 없습니다. – nKn

+0

중력선을 제거하고 layout_gravity = "center"를 선형 배치에 놓습니다. (미안해, 안드로이드는 나에게 도움이 안된다.) – VincentLamoute

+0

트릭은 ** android : layout_width = "0dp"** ** ** 1 ** ** –