view - Android Sliding Menu: Menu takes entire screen and wont retract -
i having issue sliding menu ever reason takes full screen... have looked around , had people saying need set setbehindoffsetres or setbehindoffset work.. have still doesn't work..
main activity:
package com.quapps.theinitiative; import com.jeremyfeinstein.slidingmenu.lib.slidingmenu; import com.jeremyfeinstein.slidingmenu.lib.app.slidingfragmentactivity; import com.quapps.theinitiative.r; import android.os.bundle; import android.app.activity; import android.view.menu; public class mainactivity extends slidingfragmentactivity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); setbehindcontentview(r.layout.menu_frame); slidingmenu menu = new slidingmenu(this); menu.setmode(slidingmenu.left); menu.settouchmodeabove(slidingmenu.touchmode_fullscreen); menu.setshadowwidthres(r.dimen.shadow_width); menu.setshadowdrawable(r.drawable.shadow); menu.setbehindoffsetres(r.dimen.slidingmenu_offset); menu.setfadedegree(0.35f); menu.attachtoactivity(this, slidingmenu.sliding_content); menu.setmenu(r.layout.menu_frame); //menu.setbehindoffset(100); } }
dimens.xml
<resources> <!-- default screen margins, per android design guidelines. --> <dimen name="activity_horizontal_margin">16dp</dimen> <dimen name="activity_vertical_margin">16dp</dimen> <dimen name="slidingmenu_offset">60dp</dimen> <dimen name="list_padding">10dp</dimen> <dimen name="shadow_width">15dp</dimen> </resources>
menu_frame.xml
<?xml version="1.0" encoding="utf-8"?> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/menu_frame" android:layout_width="match_parent" android:layout_height="match_parent" />
activity_main
<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" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity" > <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/hello_world" /> </relativelayout>
i understand it's stupid, can't seem find it
setting width of slidingmenu should trick, here's how can in code.
getslidingmenu().setbehindwidthres(300dp);
300dp should specified in resource/dimen file @ run-time can converted pixel value accordingly. if want specify pixels directly can use '300' only.
Comments
Post a Comment