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

레이아웃 xml이 깨져버립니다...

0 추천

레이아웃 xml 만들고 있는데.. 이게 단말기 자체 글자크기를 "아주 크게"로 설정하면 문제가 없는데.

"크게"로 설정하면 레이아웃이 깨져버립니다.. 

이거 이해가 안가서요.. 글자 크기가 커진것도 아니고 작아졌는데 왜 깨지는 걸까요??

아래는 해당 레이아웃 xml 입니다. 뭘 잘 못했는지 모르겠습니다..

 

*깨지는 현상은 마지막 체크박스의 글자가 다 나오지 않습니다. 아래 코드 마지막 레이아웃의 크기가 깨짐.

즉 마지막 @string/10부분 글자가 "테스트"인데 "테"자의 50%만 보이고 나머지는 짤립니다.

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal" android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="#808080"
    android:layout_margin="10dp">

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="#ececec"
        android:layout_marginLeft="1dp"
        android:layout_marginTop="1dp"
        android:layout_marginBottom="1dp">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="5dp"
            android:layout_marginRight="5dp"
            android:layout_marginTop="15dp"
            android:layout_marginBottom="15dp"
            android:layout_gravity="center_vertical"
            android:textSize="30dp"
            android:text="@string/title"
            />
    </LinearLayout>

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:background="#808080">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:background="#ececec"
            android:layout_marginLeft="1dp"
            android:layout_marginTop="1dp">

            <CheckBox
                android:id="@+id/checkbox1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="5dp"
                android:text="@string/1" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:background="#ececec"
            android:layout_marginLeft="1dp"
            android:layout_marginTop="1dp"
            android:layout_marginBottom="1dp">

            <CheckBox
                android:id="@+id/checkbox6"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="5dp"
                android:text="@string/6" />
        </LinearLayout>
    </LinearLayout>
  
//위의 레이아웃이 4번 반복

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:background="#808080">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:background="#ececec"
            android:layout_marginLeft="1dp"
            android:layout_marginTop="1dp"
            android:layout_marginRight="1dp">

            <CheckBox
                android:id="@+id/checkbox5"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="5dp"
                android:text="@string/5" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="0.5"
            android:background="#ececec"
            android:layout_marginLeft="1dp"
            android:layout_marginTop="1dp"
            android:layout_marginRight="1dp"
            android:layout_marginBottom="1dp">

            <CheckBox
                android:id="@+id/checkbox10"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_marginLeft="5dp"
                android:layout_marginRight="5dp"
                android:text="@string/10" />
        </LinearLayout>
    </LinearLayout>
</LinearLayout>

 

익명사용자 님이 2015년 7월 28일 질문

1개의 답변

0 추천
짐작으로는 텍스트 박스가 좁아서 글자를 다 표시 못했거나 기타 등등 다른 이유로 생기는 문제 일수 있는데요.

디버깅을 이렇게 한번 해보세요.

개발자 옵션에서 레이아웃범위 표시 하는 옵션이 있습니다. 이걸 키시면 앱에서 레이아웃 범위가 경계선으로 보이기 때문에 width 나 기타 size 문제로 짤리는지는 판단이 섭니다.

좀더 디버깅 툴을 활용한다면 Hierarchy View를 사용하여 뷰 구조별로 체크 할 수 있는데요. 이걸로 디버깅 해보시면 될듯 싶습니다.
ㄱㄴㄷ 님이 2015년 7월 28일 답변
...