android - HorizontalScrollView not scrolling -


i have 1 horizontalscrollview , 1 gridlayout inside 3 images. never scrolls thought should, no matter - gestures, touch - nothing make horizontal scroll.

my xml:

<com.app4u.borala.atividades.layout.grideventopesqgeo     android:id="@+id/horizontalscroll"     android:layout_width="fill_parent"     android:layout_height="fill_parent"     android:layout_alignparentbottom="true"     android:background="@color/azulactionbartransparente"     android:fillviewport="true"     android:scrollbars="horizontal" >      <gridlayout         android:id="@+id/grideventos"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:rowcount="1" >          <com.app4u.borala.atividades.layout.imagevieweventopesqgeo             android:id="@+id/imageevento1"             android:layout_width="match_parent"             android:layout_height="match_parent"             android:scaletype="fitxy"             android:src="@drawable/background_evento_temp" />          <com.app4u.borala.atividades.layout.imagevieweventopesqgeo             android:id="@+id/imageevento2"             android:layout_width="match_parent"             android:layout_height="match_parent"             android:scaletype="fitxy"             android:src="@drawable/background_evento_temp" />          <com.app4u.borala.atividades.layout.imagevieweventopesqgeo             android:id="@+id/imageevento3"             android:layout_width="match_parent"             android:layout_height="match_parent"             android:scaletype="fitxy"             android:src="@drawable/background_evento_temp" />     </gridlayout> </com.app4u.borala.atividades.layout.grideventopesqgeo> 

my class grideventopesqgeo:

public class grideventopesqgeo extends horizontalscrollview {  public grideventopesqgeo(context context) {     super(context); }  public grideventopesqgeo(context context, attributeset attrs) {     super(context, attrs); }  public grideventopesqgeo(context context, attributeset attrs, int defstyle) {     super(context, attrs, defstyle); }  @override protected void onmeasure(int widthmeasurespec, int heightmeasurespec) {     super.onmeasure(widthmeasurespec, heightmeasurespec);      int parentwidth = measurespec.getsize(widthmeasurespec);     int parentheight = measurespec.getsize(heightmeasurespec);      this.setmeasureddimension(parentwidth, (int) (parentheight * 0.225)); } } 

my class imagevieweventopesqgeo:

public class imagevieweventopesqgeo extends imageview{  public imagevieweventopesqgeo(context context) {     super(context); }  public imagevieweventopesqgeo(context context, attributeset attrs) {     super(context, attrs); }  public imagevieweventopesqgeo(context context, attributeset attrs, int defstyle) {     super(context, attrs, defstyle); }  @override protected void onmeasure(int widthmeasurespec, int heightmeasurespec) {     super.onmeasure(widthmeasurespec, heightmeasurespec);      int parentwidth = measurespec.getsize(widthmeasurespec);     //int parentheight = measurespec.getsize(heightmeasurespec);      marginlayoutparams lpimgfooter = (marginlayoutparams) getlayoutparams();     lpimgfooter.bottommargin = (int) (parentwidth * 0.015);     lpimgfooter.leftmargin = (int) (parentwidth * 0.015);     lpimgfooter.rightmargin = (int) (parentwidth * 0.015);     lpimgfooter.topmargin = (int) (parentwidth * 0.015);     setlayoutparams(lpimgfooter);      this.setmeasureddimension((int) (parentwidth * 0.33), (int) (parentwidth * 0.33)); } } 

my java classes make width , height proportional depending on phone's screen size..

here source of horizontalscrollview onmeasure():

@override protected void onmeasure(int widthmeasurespec, int heightmeasurespec) {     super.onmeasure(widthmeasurespec, heightmeasurespec);      if (!mfillviewport) {         return;     }      final int widthmode = measurespec.getmode(widthmeasurespec);     if (widthmode == measurespec.unspecified) {         return;     }      if (getchildcount() > 0) {         final view child = getchildat(0);         int width = getmeasuredwidth();         if (child.getmeasuredwidth() < width) {             final framelayout.layoutparams lp = (layoutparams) child.getlayoutparams();              int childheightmeasurespec = getchildmeasurespec(heightmeasurespec, mpaddingtop                     + mpaddingbottom, lp.height);             width -= mpaddingleft;             width -= mpaddingright;             int childwidthmeasurespec = measurespec.makemeasurespec(width, measurespec.exactly);              child.measure(childwidthmeasurespec, childheightmeasurespec);         }     } } 

notice if mfillviewport true, it'll return without ever reaching code. since set true in xml, no wonder code not executed.


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -