Android view jfeinstein SlidingMenu top of layouts without move content - android

by default jfeinstein SlidingMenu move content to view slide menu layout, but i dont like that and i want to view slide menu without move content and top of all layouts.
in this below screen shot i like number 2
Default settings are :
public class SlidingExample extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setTitle(R.string.attach);
// set the content view
setContentView(R.layout.content);
// configure the SlidingMenu
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);
}
}
and i'm could not find whats setting view slide menu top of all layouts ans widgets after any testing attachToActivity

wild guess (I don't use jFeinstein)..
when the slider activates, to remove the 'hamburger' icon from the ABar get rid of "home_as_up"...
getActionBar().setDisplayOptions(ActionBar.DISPLAY_SHOW_HOME |
ActionBar.DISPLAY_USE_LOGO |ActionBar.DISPLAY_HOME_AS_UP,
ActionBar.DISPLAY_HOME_AS_UP
| ActionBar.DISPLAY_SHOW_HOME | ActionBar.DISPLAY_USE_LOGO);

Related

How to use jfeinstein10/SlidingMenu both sides

First of all I am sorry to ask repeated questions. As this has been asked before but some how I could not understand properly.
I found a good solutions here. I followed and could add library to my project. Now I need to add left and right sliding menus to my project without action-bar. Here is the picture-
If I click any of the selected button then it should open the respective sliding page(once at a time) at the specific sides. Something like -
currently -
I am able to generate one side of the menu bar. It is working with sliding only. -
public class MainActivity extends FragmentActivity {
ViewPager viewPager;
PagerAdapter adapter;
CirclePageIndicator mIndicator;
private int mWidthScreen;
private int mHeightScreen;
private Bundle bundle;
private List<Fragment> frgScreens;
private int selectedtheme;
private Handler mHandler = new Handler();
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get the view from viewpager_main.xml
setContentView(R.layout.viewpager_main);
SlidingMenu menu;
menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.LEFT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowWidth(5);
menu.setFadeDegree(0.0f);
menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
menu.setBehindWidth(500);
menu.setMenu(R.layout.menu_frame);
}
Now I want in both sides and should open menu by clicking the button
Any help will be appreciated. Please feel free to ask any queries.
Well Finally I did it. Here mBtnMenu is an ImageView.
mBtnMenu = (ImageView) findViewById(R.id.btnMenu);
menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.LEFT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowWidth(5);
menu.setFadeDegree(0.0f);
menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
menu.setBehindWidth(500);
menu.setMenu(R.layout.menu_frame);
mBtnMenu.setOnClickListener(new OnClickListener() {
#Override
public void onClick(View arg0) {
// menu.showMenu();
menu.toggle();
}
});

jfeinstein10/SlidingMenu attaching a Fragment

I'm trying to implement the jfeinsteins sliding menu, however I'm having a problem getting a fragment to attach. The issue is that the layout is shown on the screen twice. I assume that this is because I setMenu and then do the replace (adding it again).
Could anyone provide some pointers please.
public void configureSlidingMenu()
{
// configure the SlidingMenu
menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.RIGHT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setFadeDegree(0.35f);
menu.attachToActivity(this, SlidingMenu.SLIDING_CONTENT);
menu.setFadeDegree(0.35f);
menu.setBehindOffset(120);
menu.setMenu(R.layout.fragment_slideoutmenu);
getFragmentManager()
.beginTransaction()
.replace(R.id.slideOutMenu, new SlideOutMenu())
.commit();
}
I did this in my application...
Created a class Util like this:
public class Util {
public static void atachLeftMenu(final Activity pActivity){
final SlidingMenu menu = new SlidingMenu(pActivity);
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(pActivity, SlidingMenu.SLIDING_WINDOW);
menu.setMenu(R.layout.side_menu);
( (ListView)(menu.findViewById(R.id.side_menu_list)) ).setAdapter(new leftMenuAdapter(pActivity));
( (ListView)(menu.findViewById(R.id.side_menu_list)) ).setOnItemClickListener( new DrawerItemClickListener(pActivity));
//Set menu options and values
}
}
And in every Activity i just call the Util's "atachLeftMenu" method.
Util.atachLeftMenu(this);
If you want to do it within a fragment you'll still have to pass it the activity so you could do something like this:
Util.atachLeftMenu(getActivity());

Android sliding menu force closed

I created a sliding menu with the library https://github.com/jfeinstein10/SlidingMenu. I created my own login view instead of slide menu succesfully with the code
public class MainActivity extends Activity {
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
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.setSecondaryMenu(R.layout.login);
}}
Now I want to make some action in login.SO how can I do this.I tried within the same main activty. but it force closed, how can I do some action in login and where should I code ?? I am new to android so please help me and thanks :)
I had the same problem.Please check Slidingmenu.java in the library and make your code in function public void setsecondarymenu()
eg: if you want to settext to a textview
public void setSecondaryMenu(int res) {
setSecondaryMenu(LayoutInflater.from(getContext()).inflate(res, null));
TextView tv=(TextView)findViewById(R.id.tv);
tv.setText("helloo i got it :)");
}
make sure that u have a layout in library that you want to view
hope this will help you :)

SlidingMenu(jfeinstein) - How to control secondary sliding menu

I am using jfenstein's sliding menu lib. But I need to control two sliding menus separately. Sometimes second has to be disabled.And sometimes first slidingmenu has to be disabled.
When I have used menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN); both of them effected.
This my code :
menu = new SlidingMenu(activity);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
menu.setShadowDrawable(R.drawable.sliding_menu_shadow);
menu.setBehindOffsetRes(R.dimen.sliding_menu_offset);
menu.setFadeDegree(0.35f);
menu.attachToActivity(activity, SlidingMenu.SLIDING_WINDOW);
menu.setMenu(R.layout.sliding_menu_frame);
menu.setMode(SlidingMenu.LEFT_RIGHT);
SlidingMenuListFragment slidingMenuListFragment = new SlidingMenuListFragment();
slidingMenuListFragment.setMenuBuilder(this);
/*
* left menu
*/
activity.getSupportFragmentManager().beginTransaction()
.replace(R.id.sliding_menu_frame, slidingMenuListFragment)
.commit();
/*
* right menu
*/
SlidingMenuListFragment rightMenu = new SlidingMenuListFragment();
rightMenu.setMenuBuilder(this);
menu.setSecondaryMenu(R.layout.sliding_menu_frame);
activity.getSupportFragmentManager()
.beginTransaction()
.replace(R.id.sliding_menu_frame, rightMenu )
.commit();
I have the same problem and I fix it with the following :
//can open left and right panel
menu.setMode(SlidingMenu.LEFT_RIGHT);
//can only open left panel and show only left (perhaps overlay the right panel ?)
menu.setMode(SlidingMenu.LEFT);
but it only works to "disable/make invisible" the right panel
if you do :
menu.setMode(SlidingMenu.RIGHT);
it only show the left panel on the right.

SlidingMenu and header

I begin to use a slidingMenu. In my application I have a header with button. when I move it sliding, than my header move too. But I want, than my header do not move, and sliding menu move under header. My header is not actionBar, usual layout.
// configure the SlidingMenu
SlidingMenu menu = new SlidingMenu(this);
menu.setMode(SlidingMenu.LEFT);
menu.setTouchModeAbove(SlidingMenu.TOUCHMODE_MARGIN);
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);
How I can do what I want?
You have to assign a button to action toggle from sliding.
findViewById(R.id.buttonToggle).setOnClickListener(new OnClickListener() {
#Override
public void onClick(View v) {
getSlidingMenu().toggle(true);
}
});

Categories

Resources