Sunday 15 July 2012

android - Using Umano SlidingUpPanel with limited drag area and drag button -



android - Using Umano SlidingUpPanel with limited drag area and drag button -

i'm using umano slidinguppanel 1 of test project have 1 problem wherein wanted create panel expand when press (not click) , drag image or when click button expand. later bit easy implement press i'm having hard time implement it.

for improve visual here xml panel:

<com.sothree.slidinguppanel.slidinguppanellayout xmlns:sothree="http://schemas.android.com/apk/res-auto" android:id="@+id/sliding_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="bottom" android:background="#00ffffff" sothree:panelheight="120dp" sothree:shadowheight="0dp" sothree:overlay="true" sothree:fadecolor="@android:color/transparent"> <relativelayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <imageview android:layout_width="match_parent" android:layout_height="match_parent" android:id="@+id/imageview2" android:src="@drawable/test_img" android:adjustviewbounds="true" android:scaletype="centercrop" /> <imageview android:layout_width="40dp" android:layout_height="40dp" android:id="@+id/ic_menu" android:src="@drawable/menu" android:layout_marginleft="5dp" android:layout_margintop="5dp" android:onclick="showdrawer" /> </relativelayout> <linearlayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="match_parent" android:background="#00ffffff"> <linearlayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="50dp" android:background="#00ffffff" android:id="@+id/transparent_panel"> <imageview android:layout_width="40dp" android:layout_height="40dp" android:id="@+id/ic_menu2" android:layout_marginleft="5dp" android:layout_margintop="5dp" android:onclick="showdrawer" android:visibility="gone" android:src="#00ffffff" /> <linearlayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center"> <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/img_expand" android:src="@drawable/img_expand" /> </linearlayout> </linearlayout> <linearlayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#66ffffff" android:id="@+id/pager_container"> <android.support.v4.view.viewpager android:id="@+id/pager" android:layout_width="match_parent" android:layout_height="match_parent" > <android.support.v4.view.pagertitlestrip android:id="@+id/pager_title" android:background="@color/yellow" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="top"/> </android.support.v4.view.viewpager> </linearlayout> </linearlayout> </com.sothree.slidinguppanel.slidinguppanellayout>

here have panel image wanted handle when expanding drawer , on code tried implement this:

imageview img_expand = (imageview) findviewbyid(r.id.img_expand); slidelayout = (slidinguppanellayout) findviewbyid(r.id.sliding_layout); slidelayout.setslidingenabled(false); img_expand.setontouchlistener(new view.ontouchlistener() { @override public boolean ontouch(view v, motionevent event) { log.e("test", string.valueof(event)); log.e("test2", string.valueof(event.action_down)); log.e("test3", string.valueof(event.getaction())); log.e("test4", string.valueof(motionevent.action_down)); log.e("test5", string.valueof(motionevent.action_move)); if (event.getaction() == motionevent.action_move || event.getaction() == motionevent.action_down) { slidelayout.setslidingenabled(true); homecoming true; }else{ slidelayout.setslidingenabled(false); homecoming false; } } });

sadly didn't work expected. hope can guide me on this. :d

android

No comments:

Post a Comment