xml - Android : Listview not visible when used outside the scrollview -


is possible show listview , scroll view in xml.this xml file. have defined listview outside scrollview. problem when scroll view in device list view not visible. , if view small if not scrolling listview visible. want scroll view below want listview show list data. me out if 1 knows solution or mistake.

code

    <relativelayout         android:layout_width="match_parent"         android:layout_height="wrap_content" >          <scrollview             android:id="@+id/scrollviewagenda"             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:layout_below="@+id/relheader" >              <linearlayout                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:orientation="vertical" >                  <view                     android:id="@+id/viewupper"                     android:layout_width="match_parent"                     android:layout_height="1dp"                     android:background="@color/gray_bg" />                  <relativelayout                     android:id="@+id/releventdesc"                     android:layout_width="match_parent"                     android:layout_height="match_parent" >                      <textview                         android:id="@+id/txtdescriptionagenda"                         android:layout_width="match_parent"                         android:layout_height="match_parent"                         android:layout_margintop="20dp"                         android:paddingleft="10dp"                         android:text="description"                         android:textcolor="@color/black"                         android:textsize="20sp" />                      <textview                         android:id="@+id/txtagendadescription"                         android:layout_width="match_parent"                         android:layout_height="match_parent"                         android:layout_below="@+id/txtdescriptionagenda"                         android:layout_margintop="5dp"                         android:padding="@dimen/eventinformationtrdescriptionpadding"                         android:textcolor="@color/gray_font"                         android:textsize="@dimen/eventinformationtextsize" />                 </relativelayout>                  <tablerow                     android:layout_width="wrap_content"                     android:layout_height="wrap_content"                     android:layout_alignbottom="@+id/txtdescription"                     android:layout_below="@+id/trdescription"                     android:layout_centerhorizontal="true"                     android:layout_gravity="center_horizontal"                     android:layout_marginbottom="10dp" >                      <textview                         android:id="@+id/txtexpanddescriptionagenda"                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:layout_alignparentbottom="true"                         android:layout_alignparentleft="true"                         android:gravity="center"                         android:text="read more"                         android:textcolor="#00e5ee"                         android:textsize="15sp" />                 </tablerow>                  <view                     android:id="@+id/viewdown"                     android:layout_width="match_parent"                     android:layout_height="1dp"                     android:background="@color/gray_bg" />                  <tablerow                     android:id="@+id/tabrowispckericonandheaderinfo"                     android:layout_width="wrap_content"                     android:layout_height="wrap_content"                     android:layout_margintop="10dp"                     android:gravity="center_vertical" >                      <textview                         android:id="@+id/txtspeakerlable"                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:paddingleft="10dp"                         android:text="speaker"                         android:textsize="18sp" />                 </tablerow>                  <relativelayout                     android:layout_width="match_parent"                     android:layout_height="wrap_content" >                      <linearlayout                         android:id="@+id/linlaynodatafound"                         android:layout_width="match_parent"                         android:layout_height="match_parent"                         android:gravity="center"                         android:orientation="vertical"                         android:visibility="gone" >                          <textview                             android:layout_width="wrap_content"                             android:layout_height="wrap_content"                             android:layout_margin="10dp"                             android:text="no speaker defined."                             android:textcolor="@color/gray"                             android:textsize="17sp" />                          <view                             android:layout_width="100dp"                             android:layout_height="100dp"                             android:background="@drawable/no_data" />                     </linearlayout>                 </relativelayout>             </linearlayout>         </scrollview>     </relativelayout>      <listview         android:id="@+id/listviewagenda"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:divider="#ffffff" >     </listview>  </linearlayout> 

if 1 aware of such situation please me out.

use this

public class expandableheightlistview {     public static void setlistviewheightbasedonchildren(listview listview) {          listadapter listadapter = listview.getadapter();          if (listadapter == null) {             // pre-condition             return;         }          int totalheight = 0;          (int = 0; < listadapter.getcount(); i++) {              view listitem = listadapter.getview(i, null, listview);              listitem.measure(0, 0);              totalheight += listitem.getmeasuredheight();         }          viewgroup.layoutparams params = listview.getlayoutparams();          params.height = totalheight                 + (listview.getdividerheight() * (listadapter.getcount() - 1));          listview.setlayoutparams(params);      } } 

in mainactivity pass listview object in method.

setlistviewheightbasedonchildren(listview);


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -