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

제가 초보 레이아웃 을 만들려고 하는데요

0 추천

이클립스에서 레이아웃 설정 하는데

<?xml version="1.0" encoding="utf-8"?>
<!-- 화면 전체의 수직 배치: 시작 -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >
    
    <!-- 3고객정보에 대한 수직배치: 시작 -->
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1" >
        
 
    
    <!-- 고객정보 1 -->
    <TextView
        android:text="@string/customer1"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1" />
    <!-- 고객정보 2 -->
    <TextView
        android:text="@string/customer2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1" />
    <!-- 고객정보 3 -->
    <TextView
        android:text="@string/customer3"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1" />
    </LinearLayout>
    <!-- 3명의 고객정보에 대한 수직배치: 끝 -->
    <!-- 3가지 색에 대한 수평배치: 시작 -->
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1">
    
        <!-- 색1 -->
        <TextView 
            android:text="@string/color1"
            android:gravity="center_horizontal"
            android:background="#ff0000"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="1" />
        <!-- 색2 -->
        <TextView 
            android:text="@string/color2"
            android:gravity="center_horizontal"
            android:background="#00ff00"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="3" />
        <!-- 색3 -->
        <TextView 
            android:text="@string/color2"
            android:gravity="center_horizontal"
            android:background="#0000ff"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:layout_weight="3" />
        
        
    </LinearLayout>
    <!-- 3가지 색에 대한 수평배치: 끝 -->
    </LinearLayout>
    <!-- 화면 전체의 수직 배치: 끝 -->
 
이렇게 짜는데 
ayout_weight<< 여기서 자꾸 오류 나네요   빨간색으로 색칠한곳이요
Nested weights are bad for performance 이라고 하면서 실행이 안되네요 
해결방법좀요
    
익명사용자 님이 2014년 4월 17일 질문
그대로 붙여보니 Warning이 뜨지 에러가 뜨지는 않네요...

다른 소스코드 상에서는 문제가 없나요?

1개의 답변

+1 추천
그부분은 에러가 아니라 경고 아닌가요?
노란색 삼각형에 !가 찍혀있는 아이콘인지 아닌지 확인해보세요~
경고라면 실행이 가능한 상태고 다른 곳에서 문제가 있을겁니다.
 
그리고 weight를 사용하는 경우 정렬되는 방향은 0dp로 설정하시는게 맞습니다.
예) LinearLayout의 orientation이 horizontal인 경우 - 자식 뷰의 android:layout_width="0dp"
Lifeclue (7,930 포인트) 님이 2014년 4월 17일 답변
...