안드로이드에서 비어있는 ListView를 다루는데 약간의 문제가 있습니다. 화면을 인수하는안드로이드에서 비어있는 ListView를 처리하는 방법?
this.getListView().setEmptyView(findViewById(android.R.id.empty));
그리고 main_activity.xml 에 빈 ID로 텍스트 뷰를 삽입하지만 결과는했다 : 나는 무엇을 시도했다
public class MainActivity extends ListActivity {
...
refreshList();
...}
public void refreshAlbumList(){
albumList=control.listAlbums();
if (albumList.length!=0){
ArrayAdapter<String> ap = new ArrayAdapter<String>(this,android.R.layout.simple_list_item_1,albumList);
setListAdapter(ap);
}else{
//deal with empty list somehow, currently results in error
}
}
는 : 여기있어 무엇 목록을 볼 수 없었습니다.
현재 XML :
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:android1="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
tools:context=".MainActivity" >
<ListView
android1:id="@id/android:list"
android1:layout_width="match_parent"
android1:layout_height="wrap_content"
android1:layout_weight="1" >
</ListView>
</LinearLayout>
쉬운 방법은 바로 목록보기에서 다른 텍스트 뷰를 선언 할 것입니다. –