2013-06-03 55 views

回答

0

in getHeaderView - set HeaderView.Visibility(View.GONE);

0

我有同樣的問題。 header.setVisibility(View.GONE)不起作用。

解決辦法是:

佈局頭視圖必須與layout_height = 「WRAP_CONTENT」

,然後,此佈局的內容,可以setVisibility(View.GONE)

0

我用相同適配器兩個佈局

佈局與頭

<se.emilsjolander.stickylistheaders.StickyListHeadersListView 
android:id="@+id/listview" 
android:layout_width="match_parent" 
android:layout_height="wrap_content" 
android:background="@android:color/white" /> 

佈局而不頭

<ListView xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/listview" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

onCreateView:上任務結果

if (needHeader) { 
    mainView = inflater.inflate(R.layout.ly_list_with_header, null); 
    stickyListHeadersListView = (StickyListHeadersListView) mainView.findViewById(R.id.listview); 
} else { 
    mainView = inflater.inflate(R.layout.ly_without_header, null); 
    listView = (ListView) mainView.findViewById(R.id.listview); 
} 

if (needHeader) { 
    stickyListHeadersListView.setAdapter(adapter); 
} else { 
    listView.setAdapter(adapter); 
}