android - ListView not displaying -


i have layout contains 3 spinners,1 edittext,1 butto , below button have placed listview.the listview has header not displaying. reason not showing. have attached xml file , java code create header.

<?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="vertical"     android:padding="@dimen/activity_vertical_margin" >      <spinner         android:id="@+id/yearspinner"         android:layout_width="fill_parent"         android:layout_height="wrap_content" />      <spinner         android:id="@+id/monthspinner"         android:layout_width="fill_parent"         android:layout_height="wrap_content" />      <spinner         android:id="@+id/dayspinner"         android:layout_width="fill_parent"         android:layout_height="wrap_content" />      <edittext         android:id="@+id/amountedittext"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:ems="10"         android:inputtype="number"          android:hint="@string/amount">     </edittext>      <button         android:id="@+id/add_button"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:text="@string/addproduct_button"         android:textcolor="#372c24" />      <listview         android:id="@+id/listview"         android:layout_width="match_parent"         android:layout_height="wrap_content" >     </listview> </linearlayout> 

============================================

visibletable = (listview) findviewbyid(r.id.listview);      createtableheader();      private void createtableheader() {     view header = (view) getlayoutinflater().inflate(r.layout.listview_header_row, null);     visibletable.addheaderview(header, null, false); } 

======================

this header xml

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/relativelayout1" android:layout_width="fill_parent" android:layout_height="fill_parent"  android:background="#ff347c12">  <textview     android:id="@+id/thirdtext"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:gravity="left"     android:paddingbottom="5dp"     android:paddingtop="5dp"     android:text="@string/amount"     android:width="50dip" >  </textview>  <textview     android:id="@+id/secondtext"     android:layout_width="0dip"     android:layout_height="wrap_content"     android:layout_weight="0.60"     android:gravity="right"     android:paddingbottom="5dp"     android:paddingtop="5dp"     android:text="@string/date"     android:width="150dip" >  </textview>  <textview     android:id="@+id/firsttext"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:gravity="right"     android:paddingbottom="5dp"     android:paddingtop="5dp"     android:width="20dip" /> 

if listview empty, nothing shown that's normal. header view shown when there no data, have @ question list activity header, footer , empty visible


Comments