android - sliding up panel - thin line sliding panel under google mapfragment -
i made slidinguppanel using repository https://github.com/dlukashev/androidslidinguppanel-foursquare-map-demo
however, contains 1 bug not covered anywhere.
when touch anywhere expand panel (listview) works well, while i'm trying expand holding top of list view (blue line on screen2) panel hide under map (framelayout) (screen3)
how it's possible blue line hiding panel under mapfragment , rest of listview expand well?
any ideas why? please give me hint how fix it?
please @ screen:
<?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="fill_parent" android:layout_height="fill_parent"> <org.sothree.slidinguppanel.slidinguppanellayout android:id="@+id/slidinglayout" android:gravity="bottom" app:shadowheight="0dp" app:paralaxoffset="@dimen/paralax_offset" android:layout_width="fill_parent" android:layout_height="fill_parent"> <framelayout android:gravity="top" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@+id/button"> <relativelayout android:id="@+id/mapcontainer" android:layout_width="fill_parent" android:layout_height="497dp"/> </framelayout> <relativelayout android:id="@+id/slidingcontainer" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@+id/button"> <view android:id="@+id/transparentview" android:visibility="gone" android:layout_width="fill_parent" android:layout_height="@dimen/map_height" android:layout_alignparenttop="true"/> <listview android:id="@+id/listview1" android:cachecolorhint="@android:color/white" android:drawselectorontop="true" android:dividerheight="@dimen/divider_height" android:divider="@android:color/darker_gray" android:background="@android:color/transparent" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_below="@id/transparentview" android:smoothscrollbar="true" android:layout_margintop="0dp"/> </relativelayout> </org.sothree.slidinguppanel.slidinguppanellayout> </relativelayout>
you need override listview
public class lockablelistview extends listview { private boolean mscrollable = true; public lockablelistview(context context) { super(context); } public lockablelistview(context context, attributeset attrs) { super(context, attrs); } public lockablelistview(context context, attributeset attrs, int defstyle) { super(context, attrs, defstyle); } public void setscrollingenabled(boolean enabled) { mscrollable = enabled; } @override public boolean ontouchevent(motionevent ev) { switch (ev.getaction()) { case motionevent.action_down: // if can scroll pass event superclass if (mscrollable) { return super.ontouchevent(ev); } // continue handle touch event if scrolling enabled return mscrollable; // mscrollable false @ point default: return super.ontouchevent(ev); } } @override public boolean onintercepttouchevent(motionevent ev) { // don't intercepted touch events if // not scrollable if (!mscrollable) { return false; } else { return super.onintercepttouchevent(ev); } }
}
then put disable scrolling when needed
private void collapsemap() { mspaceview.setvisibility(view.visible); mtransparentview.setvisibility(view.gone); if (mmap != null && mlocation != null) { mmap.animatecamera(cameraupdatefactory.newlatlngzoom(mlocation, 11f), 1000, null); } mlistview.setscrollingenabled(true); } private void expandmap() { mspaceview.setvisibility(view.gone); mtransparentview.setvisibility(view.invisible); if (mmap != null) { mmap.animatecamera(cameraupdatefactory.zoomto(14f), 1000, null); } mlistview.setscrollingenabled(false); }
i pushed changes github https://github.com/dlukashev/androidslidinguppanel-foursquare-map-demo/commit/7b869394e9d197e6f56a833804426577dcb8458a
enjoy
Comments
Post a Comment