나의 플랫폼/안드로이드
[ Android ] 리스트 뷰가 비어 있을때 처리
GsBOB
2011. 7. 12. 10:23
리스트 뷰에 아무 데이터가 없을 경우 처리하는 방법이 있다.
<ListView
android:id="@id/android:list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>
<LinearLayout
android:id="@id/android:empty"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="등록된 사용자가 없습니다."
android:textSize="15dp"
android:layout_marginTop="15dp"
android:gravity="center_vertical|center_horizontal"/>
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/icon"/>
</LinearLayout>
이렇게 empty로 지정을 해주면 어떤 View든지 리스트가 비어있을 때 출력을 가능하게 합니다.^^
참고하세요~ ㅋ