android - ListViews within ScrollView overlaps my TextViews -


i've seen lot of problem related mine, however, none of have worked. designing view have 4 listviews within scrollview, , want make whole scrollview scroll, while items in listviews showing. no problem; however, listviews keep overlapping headertexts different listviews.

i've tried both margins , paddings; none of whom work. i've tried remake scrolllayout linearlayout. i've tried put texts within separate linearlayouts, separated listviews, not work either.

below src code. know how make text not overlap top item in listviews? btw, "top result", 1 above, works totally fine.

<scrollview     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:id="@+id/scrollview"     android:layout_alignparenttop="true">     <relativelayout         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:id="@+id/scrolllayout">          <relativelayout             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:layout_alignparenttop="true"             android:layout_centerhorizontal="true"             android:id="@+id/topresultlayout">              <textview                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:id="@+id/topresulttitle"                 android:textsize="20sp"                 android:textisselectable="false"                 android:layout_alignparentstart="true"                 android:layout_alignparentleft="true"                 android:layout_alignparenttop="true"                 android:textcolor="#000000" />              <listview                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:id="@+id/topresultlist"                 android:layout_below="@id/topresulttitle"/>          </relativelayout>          <relativelayout             android:layout_width="match_parent"             android:layout_height="wrap_content"              android:layout_centerhorizontal="true"             android:id="@+id/streamresultlayout"             android:layout_below="@id/topresultlayout">              <textview                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:id="@+id/streamresulttitle"                 android:textsize="20sp"                 android:textisselectable="false"                 android:layout_alignparentstart="true"                 android:layout_alignparentleft="true"                 android:layout_alignparenttop="true"                 android:textcolor="#000000" />              <textview                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:id="@+id/seeallstreams"                 android:layout_alignparentend="true"                 android:layout_alignparentright="true"                 android:layout_alignparenttop="true"                 android:textcolor="#000000"                 android:textsize="14sp"                 android:layout_above="@+id/streamresultlist" />                  <listview                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:id="@+id/streamresultlist"                 android:layout_below="@id/streamresulttitle"/>         </relativelayout>          <relativelayout             android:layout_width="match_parent"             android:layout_height="wrap_content"              android:layout_centerhorizontal="true"             android:id="@+id/broadcasterresultlayout"             android:layout_below="@id/streamresultlayout">              <textview                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:id="@+id/broadcasterresulttitle"                 android:layout_alignparentstart="true"                 android:layout_alignparentleft="true"                 android:layout_alignparenttop="true"                 android:textsize="20sp"                 android:textisselectable="false"                  android:textcolor="#000000" />              <textview                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:id="@+id/seeallbroadcasters"                 android:layout_alignparentend="true"                 android:layout_alignparentright="true"                 android:layout_alignparenttop="true"                  android:textcolor="#000000"                 android:textsize="14sp" />                 <listview                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:id="@+id/broadcasterresultlist"                 android:layout_below="@id/broadcasterresulttitle"/>         </relativelayout>          <relativelayout             android:layout_width="match_parent"             android:layout_height="wrap_content"              android:layout_centerhorizontal="true"             android:id="@+id/tagresultlayout"             android:layout_below="@id/broadcasterresultlayout"             android:layout_alignparentbottom="true">              <textview                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:id="@+id/tagresulttitle"                 android:layout_alignparentstart="true"                 android:layout_alignparentleft="true"                 android:layout_alignparenttop="true"                 android:textsize="20sp"                 android:textisselectable="false"                 android:textcolor="#000000" />              <textview                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:id="@+id/seealltags"                 android:layout_alignparentend="true"                 android:layout_alignparentright="true"                 android:layout_alignparenttop="true"                 android:textcolor="#000000"                 android:textsize="14sp" />                 <listview                 android:layout_width="wrap_content"                 android:layout_height="wrap_content"                 android:id="@+id/tagresultlist"                 android:layout_below="@id/tagresulttitle"/>         </relativelayout>     </relativelayout> </scrollview> 

public static void setlistviewheightbasedonchildren(listview listview, listadapter adapter)     {         listadapter listadapter = adapter;          if (listadapter == null) {             return;         }          int desiredwidth = view.measurespec.makemeasurespec(listview.getwidth(), view.measurespec.unspecified);         int totalheight = 0;         view view = null;         (int = 0; < listadapter.getcount(); i++) {             view = listadapter.getview(i, view, listview);             if (i == 0) {                 view.setlayoutparams(new viewgroup.layoutparams(desiredwidth, viewgroup.layoutparams.wrap_content));             }             view.measure(desiredwidth, view.measurespec.unspecified);             totalheight += view.getmeasuredheight();         }         viewgroup.layoutparams params = listview.getlayoutparams();         params.height = totalheight;         listview.setlayoutparams(params);         listview.requestlayout();     } 

Comments