android - ListView in SlidingUpPanel is not scrollable -
i use library, https://github.com/umano/androidslidinguppanel, , put listview inside, not work, no scrolling, why? not listview, entire layout not roll, nor textview, nor image, nothing. here xml code:
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".detalhe_linha" <com.sothree.slidinguppanel.slidinguppanellayout android:id="@+id/sliding_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <textview android:id="@+id/textview1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="próximo onibûs sai ponto final em" /> <textview android:id="@+id/txtprox" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="x minutos" android:layout_gravity="center" android:textappearance="?android:attr/textappearancelarge" /> <gridview android:id="@+id/tabelahorarios" android:layout_width="315dp" android:layout_height="match_parent" android:layout_x="0dp" android:layout_y="123dp" android:layout_gravity="center" android:numcolumns="3" > </gridview> </linearlayout> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="#cccc" android:orientation="vertical"> <textview android:layout_width="match_parent" android:layout_height="34dp" android:gravity="center|bottom" android:text="itinerário" android:textsize="16sp" /> <textview android:id="@+id/brought_by" android:layout_width="match_parent" android:layout_height="34dp" android:gravity="center|top" android:text="arraste para cima" android:textsize="14sp" android:autolink="web" /> <textview android:id="@+id/itinerarios" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center|top" android:text="" android:textsize="17sp" android:autolink="web" /> </linearlayout> </com.sothree.slidinguppanel.slidinguppanellayout> </linearlayout>
by way, sorry bad english.
i found issue slidinguppanellayout intercepts touch events (onintercepttouchevent
). solutions rewriting (or overriding) method isdragviewhit
checked in case motionevent.action_down
, can potentially cancel intercepting given touch event.
here solution cancels intercepting if panel expanded allowing click/scroll expanded child panel. means can't slide down expanded panel. implemented collapsing of panel on button click. check implementation , give ideas possible.
private boolean isdragviewhit(int x, int y) { if(isexpanded()){ //don't intercept touch if panel expanded return false; } else{ //original implementation - allow dragging on mdragview view v = mdragview != null ? mdragview : mslideableview; if (v == null) return false; int[] viewlocation = new int[2]; v.getlocationonscreen(viewlocation); int[] parentlocation = new int[2]; this.getlocationonscreen(parentlocation); int screenx = parentlocation[0] + x; int screeny = parentlocation[1] + y; return screenx >= viewlocation[0] && screenx < viewlocation[0] + v.getwidth() && screeny >= viewlocation[1] && screeny < viewlocation[1] + v.getheight(); } }
Comments
Post a Comment