android - My list view does not get scrolled -


pfb layout

my listview not scrolled have 3 list below 1 relative layout structure when click on relative layout list gets visible . working fine when click on relative layout , after data populated . list not seem scroll.

 <scrollview         android:layout_width="match_parent"         android:layout_height="580dp" >          <linearlayout             android:layout_width="match_parent"             android:layout_height="wrap_content"             android:layout_marginleft="20dp"             android:layout_marginright="20dp"             android:layout_margintop="20dp"             android:background="@drawable/bg_box"             android:orientation="vertical"             android:padding="20dp" >              <relativelayout                 android:id="@+id/landrel"                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:background="@drawable/bar" >                  <textview                     android:id="@+id/landholdingtext"                     android:layout_width="wrap_content"                     android:layout_height="wrap_content"                     android:layout_alignparentleft="true"                     android:layout_centervertical="true"                     android:layout_marginleft="63dp"                     android:text="land holding : 0 land"                     android:textcolor="#ffffff" />                  <imageview                     android:id="@+id/arrowlandholding"                     android:layout_width="wrap_content"                     android:layout_height="wrap_content"                     android:layout_alignparentright="true"                     android:layout_alignright="@+id/landholdingtext"                     android:layout_marginright="50dp"                     android:layout_margintop="24dp"                     android:src="@drawable/up_aarow" />             </relativelayout>              <listview                 android:id="@+id/landholdinglist"                 android:layout_width="match_parent"                 android:layout_height="100dp"                 android:visibility="gone" >             </listview>              <relativelayout                 android:id="@+id/familyrel"                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:layout_margintop="10dp"                 android:background="@drawable/bar" >                  <textview                     android:id="@+id/familydetailstext"                     android:layout_width="wrap_content"                     android:layout_height="wrap_content"                     android:layout_alignparentleft="true"                     android:layout_centervertical="true"                     android:layout_marginleft="63dp"                     android:text="family details : 0  memeber"                     android:textcolor="#ffffff" />                  <imageview                     android:id="@+id/arrowfamily"                     android:layout_width="wrap_content"                     android:layout_height="wrap_content"                     android:layout_alignparentright="true"                     android:layout_alignright="@+id/familydetailstext"                     android:layout_marginright="50dp"                     android:layout_margintop="24dp"                     android:src="@drawable/up_aarow" />             </relativelayout>              <listview                 android:id="@+id/familydetailslist"                 android:layout_width="match_parent"                 android:layout_height="100dp"                 android:visibility="gone" >             </listview>              <relativelayout                 android:id="@+id/bankrel"                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:layout_margintop="10dp"                 android:background="@drawable/bar" >                  <textview                     android:id="@+id/bankdetailstext"                     android:layout_width="wrap_content"                     android:layout_height="wrap_content"                     android:layout_alignparentleft="true"                     android:layout_centervertical="true"                     android:layout_marginleft="63dp"                     android:text="bank details "                     android:textcolor="#ffffff" />                  <imageview                     android:id="@+id/arrowbank"                     android:layout_width="wrap_content"                     android:layout_height="wrap_content"                     android:layout_alignparentright="true"                     android:layout_alignright="@+id/bankdetailstext"                     android:layout_marginright="50dp"                     android:layout_margintop="24dp"                     android:src="@drawable/up_aarow" />             </relativelayout>              <listview                 android:id="@+id/bankdetailslist"                 android:layout_width="match_parent"                 android:layout_height="100dp"                 android:visibility="gone" >             </listview>              <relativelayout                 android:id="@+id/otherrel"                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:layout_margintop="10dp"                 android:background="@drawable/bar" >                  <textview                     android:id="@+id/otherdetailstext"                     android:layout_width="wrap_content"                     android:layout_height="wrap_content"                     android:layout_alignparentleft="true"                     android:layout_centervertical="true"                     android:layout_marginleft="63dp"                     android:text="other details "                     android:textcolor="#ffffff" />                  <imageview                     android:id="@+id/arrowother"                     android:layout_width="wrap_content"                     android:layout_height="wrap_content"                     android:layout_alignparentright="true"                     android:layout_alignright="@+id/otherdetailstext"                     android:layout_marginright="50dp"                     android:layout_margintop="24dp"                     android:src="@drawable/up_aarow" />             </relativelayout>              <listview                 android:id="@+id/otherdetailslist"                 android:layout_width="match_parent"                 android:layout_height="100dp"                 android:visibility="gone" >             </listview>              <linearlayout                 android:layout_width="match_parent"                 android:layout_height="wrap_content"                 android:layout_marginbottom="10dp"                 android:gravity="center_horizontal"                 android:orientation="horizontal"                 android:weightsum="2" >                  <linearlayout                     android:layout_width="0dp"                     android:layout_height="wrap_content"                     android:layout_weight="1"                     android:gravity="center_horizontal"                     android:orientation="vertical"                       >                      <imageview                         android:id="@+id/aadharcardimgview"                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:layout_margintop="10dp"                          android:src="@drawable/aadhar_card_butt_copy" />                      <textview                         android:id="@+id/aadharcardtxtview"                         android:layout_margintop="5dp"                         android:layout_marginbottom="10dp"                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:text="aadhar card" />                  </linearlayout>                      <linearlayout                     android:layout_width="0dp"                     android:layout_height="wrap_content"                     android:layout_weight="1"                     android:gravity="center_horizontal"                     android:orientation="vertical"                       >                  <imageview                     android:id="@+id/passbookimgview"                     android:layout_width="wrap_content"                     android:layout_height="wrap_content"                     android:layout_margintop="10dp"                      android:layout_weight="1"                     android:src="@drawable/passbook_butt" />                   <textview                         android:id="@+id/passbooktxtview"                             android:layout_margintop="5dp"                                 android:layout_marginbottom="10dp"                         android:layout_width="wrap_content"                         android:layout_height="wrap_content"                         android:text="passbook" />              </linearlayout>                     </linearlayout>         </linearlayout>     </scrollview> 

my adapter layout

<?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:background="@drawable/field_bar_bg"     android:weightsum="6"     android:orientation="horizontal" >      <textview         android:paddingtop="25dp"         android:id="@+id/rsnumbertxt"         android:layout_width="0dp"         android:layout_height="wrap_content"       android:gravity="center"         android:layout_weight="1"         android:text="126/1" />      <textview         android:id="@+id/type"          android:paddingtop="25dp"         android:layout_width="wrap_content"         android:layout_height="wrap_content"           android:gravity="center"            android:layout_weight="1"         android:text="oil palm" />      <textview         android:id="@+id/year"          android:paddingtop="25dp"         android:layout_width="wrap_content"         android:layout_height="wrap_content"          android:gravity="center"            android:layout_weight="1"         android:text="2007-08" />      <imageview         android:id="@+id/visitbutton"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_weight="1"         android:src="@drawable/visit_button" />      <imageview         android:id="@+id/yieldbutton"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_weight="1"         android:src="@drawable/yield_button" />      <imageview         android:id="@+id/landbutton"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_weight="1"         android:src="@drawable/land_button" />  </linearlayout> 

the reason behind - listview inside scrollview

do following fix trouble -

 listview lv = (listview)findviewbyid(r.id.landholdinglist);  // listview inside scrollview lv.setontouchlistener(new listview.ontouchlistener() {         @override         public boolean ontouch(view v, motionevent event) {             int action = event.getaction();             switch (action) {             case motionevent.action_down:                 // disallow scrollview intercept touch events.                 v.getparent().requestdisallowintercepttouchevent(true);                 break;              case motionevent.action_up:                 // allow scrollview intercept touch events.                 v.getparent().requestdisallowintercepttouchevent(false);                 break;             }              // handle listview touch events.             v.ontouchevent(event);             return true;         }     }); 

what disable touchevents on scrollview , make listview intercept them. simple , works time.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -