Tuesday, 15 September 2015

slider - Right slide secondary menu in android -



slider - Right slide secondary menu in android -

i got sliding menu lib here, dont no wrong here, in right side slide menu appears blank. here code

// customize slidingmenu slidingmenu sm = getslidingmenu(); sm.setmode(slidingmenu.left_right); sm.setshadowwidthres(r.dimen.shadow_width); sm.setshadowdrawable(r.drawable.shadow); sm.setbehindoffsetres(r.dimen.slidingmenu_offset); sm.setfadedegree(0.35f); //sm.settouchmodeabove(slidingmenu.left_right); getsupportactionbar().setdisplayshowhomeenabled(true); getsupportactionbar().setdisplayhomeasupenabled(true);

here way i'm calling secondarymenu

@override public boolean onoptionsitemselected(menuitem item) { switch (item.getitemid()) { case android.r.id.home: showsecondarymenu(); homecoming true; } homecoming super.onoptionsitemselected(item); } }

here way i'm instantiating fragment.

setcontentview(r.layout.activity_home_frame); getsupportfragmentmanager() .begintransaction() .replace(r.id.home_screen, new mapfragment()) .commit(); getslidingmenu().setsecondarymenu(r.layout.activity_home_frame); getsupportfragmentmanager() .begintransaction() .replace(r.id.home_screen, new mapfragment()) .commit(); // set behind view setbehindcontentview(r.layout.activity_settings_frame); getsupportfragmentmanager() .begintransaction() .replace(r.id.settings_screen, new settingsfragment()) .commit();

my map fragment

public class mapfragment extends sherlockfragment{ public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { homecoming inflater.inflate(r.layout.activity_map, null); } @override public void onsaveinstancestate(bundle outstate) { super.onsaveinstancestate(outstate); } }

settings fragment

public class settingsfragment extends sherlockfragment{ public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { homecoming inflater.inflate(r.layout.activity_settings, null); } @override public void onsaveinstancestate(bundle outstate) { super.onsaveinstancestate(outstate); } }

settings layout

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <textview android:layout_width="fill_parent" android:layout_height="fill_parent" android:text="settings view." ></textview> </linearlayout>

map layout

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <textview android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="your map " ></textview> </linearlayout>

kindly tell why i'm getting right side menu blank?

it got worked, problem is. instead of this

getslidingmenu().setsecondarymenu(r.layout.activity_home_frame);

i need phone call

getslidingmenu().setsecondarymenu(getlayoutinflater().inflate(r.layout.activity_map, null));

android slider actionbarsherlock

No comments:

Post a Comment