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

리니어레이아웃의 background가 리스트뷰 아래로는 적용되지 않습니다.

0 추천

 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#222222"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/kao"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_gravity="center"
        android:layout_marginTop="20dp"
        android:gravity="center"
        android:hint="안녕하세요"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textColor="#ffffff" />

    <Button
        android:id="@+id/create"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:layout_marginTop="5dp"
        android:background="@drawable/set"
        android:gravity="center"
        android:text="버튼"
        android:textColor="#ffffff"
        android:textSize="25dp"
        android:textStyle="bold" />

    <ListView
        android:id="@+id/lv"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="10dp"
        android:background="#ffffff" >
    </ListView>

</LinearLayout>

 

 

사진은 애플리케이션을 실행했을 때 모습이고 아래는 xml 소스입니다.

사진에 텍스트로 적었듯이 리스트뷰에 아무 것도 추가되지 않은 상태에서는 리니어 레이아웃의 background가 아래에

적용되지 않았고, 리스트뷰에 아이템이 추가되었더라도 추가되지 않은 빈 부분에는 여전히 LinearLayout의 background가 적용되지 않은 채 빈 화면을 유지합니다.

어떻게 해야 아이템이 없는 상태에서도 LinearLayout의 background를 화면에 채울 수 있을까요? 

하루퍼 (710 포인트) 님이 2014년 7월 19일 질문

1개의 답변

0 추천
해결했습니다!

리니어레이아웃의 layout_height 를 match_parent로 바꾸니 잘 되네요ㅠㅠ
하루퍼 (710 포인트) 님이 2014년 7월 19일 답변
...