마스터Q&A 안드로이드는 안드로이드 개발자들의 질문과 답변을 위한 지식 커뮤니티 사이트입니다. 안드로이드펍에서 운영하고 있습니다. [사용법, 운영진]

레이아웃 weight관련 서브 Button등을 붙이면 레이아웃이 깨지는 현상

0 추천

안녕하세요 오랜만에 글쓰네요

 

레이아웃을 weight 를 이용하여

1 : 1 : 1 화면을 만들었습니다.

 

그런뒤 그안에 버튼을 집어넣으니 그 비율이 깨지는 거예요

버튼이 들어간 부분이 더 넓게 차지하게 되는거에요

이런 현상을 미리 경험하신 분 없으신가요??

해결하신분 알려주시면 너무 감사할거예요

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:weightSum="3"
    android:background="#ffffffff">
<LinearLayout  
     android:orientation="horizontal"
    android:layout_width="wrap_content" 
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:weightSum="1"
    android:layout_margin="0dip"
    android:background="#ffff0000">
    </LinearLayout>
    <LinearLayout  
     android:orientation="horizontal"
    android:layout_width="wrap_content" 
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:weightSum="1"
   android:layout_margin="0dip"
    android:background="#ff00ff00">
    </LinearLayout>
      
    <LinearLayout  
     android:orientation="horizontal"
    android:layout_width="wrap_content" 
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:weightSum="1"
    android:background="#ff0000ff">
    </LinearLayout>
</LinearLayout>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:weightSum="3"
    android:background="#ffffffff">
<LinearLayout  
     android:orientation="horizontal"
    android:layout_width="wrap_content" 
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:weightSum="1"
    android:layout_margin="0dip"
    android:background="#ffff0000">
    <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/loginButton1"
  android:layout_padding="0dip"
            android:text="a"
             android:layout_weight="1"
        />
    </LinearLayout>
    <LinearLayout  
     android:orientation="horizontal"
    android:layout_width="wrap_content" 
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:weightSum="1"
   android:layout_margin="0dip"
    android:background="#ff00ff00">
    <Button
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
             android:layout_padding="0dip"
android:id="@+id/loginButton2"
            android:text="b"
             android:layout_weight="1"
        />
    </LinearLayout>
      
    <LinearLayout  
     android:orientation="horizontal"
    android:layout_width="wrap_content" 
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:weightSum="1"
    android:background="#ff0000ff">
    </LinearLayout>
</LinearLayout>

 

목표토익850 (200 포인트) 님이 2013년 4월 29일 질문

1개의 답변

+2 추천
 
채택된 답변
width 를 0dp를 주고 해보셨나요? weight를 주면 width를 0으로 해야 제대로나오던데...
Ecstasy000 (540 포인트) 님이 2013년 4월 29일 답변
목표토익850님이 2013년 5월 3일 채택됨
위스를 줘도같은현상이네요 ㅜㅜ
죄송합니다 위스를 0으로 주니 잘되네요
처음에 잘못이해해서 그냥 width 했는데 layout_width = '0dip'으로 하니잘되네요 감사합니다.
...