android - Behind Offset Sliding Menu -


i'm using jfeinstein10's sliding menu. have following xml code:

<com.slidingmenu.lib.slidingmenu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:sliding="http://schemas.android.com/apk/res-auto" android:id="@+id/sliding_in" android:layout_width="match_parent" android:layout_height="match_parent" sliding:viewbehind="@layout/activity_main" sliding:viewabove= "@layout/slidingcontent" sliding:touchmodeabove="fullscreen" sliding:selectorenabled="true" sliding:behindoffset="@dimen/slidingmenu" /> 

@dimen made new dimension value of 100px:

     <dimen name = "slidingmenu">100px</dimen> 

however when run project sliding menu covers entire screen. works if put following line in oncreate:

getslidingmenu().setbehindoffset(100)

how can specify entire layout in xml?

let's have xml file named "dimens" stored in "values" folder.

<resources>  <!-- default screen margins, per android design guidelines. --> <dimen name="slidingmenu_offset">160dp</dimen> <dimen name="list_padding">10dp</dimen> <dimen name="shadow_width">5dp</dimen>  <integer name="num_cols">1</integer> </resources> 

then can use code follow:

slidingmenu sm = getslidingmenu(); sm.setbehindoffsetres(r.dimen.slidingmenu_offset); 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -