android - Fragment over another fragment that can be closed swiping up -
i've made fragment fullscreen overlay fragment b. want handle swipe touch can close fragment swiping , reopen swiping down.
how can implement that? i've not found tutorial of particular case. thank you.
compile 'me.imid.swipebacklayout.lib:library:1.0.0'
<relativelayout 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="com.example.darwich.swipetoclose.mainactivity"> <radiogroup android:id="@+id/id_radiogroup" android:layout_centerhorizontal="true" android:layout_margintop="40dp" android:layout_width="wrap_content" android:layout_height="wrap_content"> <radiobutton android:id="@+id/mode_left" android:text="left" android:textsize="24sp" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <radiobutton android:id="@+id/mode_right" android:text="right" android:textsize="24sp" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <radiobutton android:id="@+id/mode_bottom" android:text="bottom" android:textsize="24sp" android:layout_width="wrap_content" android:layout_height="wrap_content" /> <radiobutton android:id="@+id/all" android:text="all" android:textsize="24sp" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </radiogroup> </relativelayout>
public class mainactivity extends swipebackactivity { private swipebacklayout swipebacklayout; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); radiogroup trackingmodegroup = (radiogroup) findviewbyid(r.id.id_radiogroup); swipebacklayout = getswipebacklayout(); trackingmodegroup.setoncheckedchangelistener(new radiogroup.oncheckedchangelistener() { @override public void oncheckedchanged(radiogroup group, int checkedid) { int edgeflag; switch (checkedid) { case r.id.mode_left: edgeflag = swipebacklayout.edge_left; break; case r.id.mode_right: edgeflag = swipebacklayout.edge_right; break; case r.id.mode_bottom: edgeflag = swipebacklayout.edge_bottom; break; default: edgeflag = swipebacklayout.edge_all; } swipebacklayout.setedgetrackingenabled(edgeflag); } }); } }
Comments
Post a Comment