2012-06-01 4 views
0

제목에서 알 수 있듯이 내 목록보기가 채워지지 않습니다. 나는 어댑터가 3 가지 항목으로 채워지고 있음을 알고 그것을 통해 디버깅했다. 하지만 내 XML 전혀 아무것도 게재되지 않습니다 :android ListView가 업데이트되지 않습니다

어댑터는 무엇이든해야 전역 변수입니다. 코드 : 활동의

private void listChange(CustomCursor c){ 

    List<SimpleListItem> itemsList = new ArrayList<SimpleListItem>(); 

    while (c.moveToNext()) { 
     String picture = c.getString("picture"); 
     String text = c.getString("name"); 
     itemsList.add(new SimpleListItem(text, picture)); 

    } 
    productListAdapter = new ProductAdapter(getBaseContext(),R.layout.product_item, itemsList); 
    setListAdapter(productListAdapter); 
    productListAdapter.notifyDataSetChanged(); 


} 

XML : 당신이 ListView를보고 싶다면

<?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="match_parent" 
    android:orientation="horizontal" > 

    <dk.foo.views.PageHeaderView 
     android:id="@+id/header" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" > 
    </dk.foo.views.PageHeaderView> 

    <ListView 
     android:id="@+id/android:list" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content"> 

    </ListView> 

</LinearLayout> 
+0

'ListView'를 선언 한 전체 레이아웃 파일을 추가하십시오. – Luksprog

+0

죄송 stackoverflow 코드 삽입 오류;) –

+0

전체 소스 코드를 포함합니다. 도움이 될 –

답변

2

verticalLinearLayoutorientation을 수정합니다.

는 지금 horizontal에 부모 LinearLayout 세트의 orientationPageHeaderView 세트 FILL_PARENT에 사용자 정의보기의 width, 당신의 ListView으로 화면에서 푸시됩니다.

+0

Duh, 대단히 감사합니다! –

관련 문제