SlidingMenu
SlidingMenu copied to clipboard
How to overlap slidingMenu over MainActivity
This library moves Original/ Main activity toward right or left completely but Instead I want to make Sliding Menu Overlap the originalActivity or MainActivity how can I do it?
I have the same question, how can I do that :) ?
<android.support.v4.widget.DrawerLayout > <RelativeLayout > <com.ehc.justkapture.helper.CustomTextView android:id="@+id/handle_to_open_drawer" android:layout_centerVertical="true" android:drawableLeft="@drawable/menu_open" /> <com.ehc.justkapture.helper.CustomTextView android:id="@+id/handle_to_close_drawer" ***** android:layout_centerVertical="true" android:drawableLeft="@drawable/menu_close" android:visibility="gone"/> </RelativeLayout> <FrameLayout android:id="@+id/content_frame" android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="right"> <ListView android:id="@+id/drawer_item_listView1" > </ListView> </FrameLayout> </android.support.v4.widget.DrawerLayout> /**_/ drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout); closeButton = (TextView) findViewById(R.id.handle_); openButton = (TextView) findViewById(R.id.handle); drawerLayout.setDrawerListener(getListener());
@NonNull private DrawerLayout.SimpleDrawerListener getListener() { return new DrawerLayout.SimpleDrawerListener() { @Override public void onDrawerSlide(View drawerView, float slideOffset) { super.onDrawerSlide(drawerView, slideOffset); float xPositionOpenDrawer = listView.getWidth(); float xPositionWindowContent = (slideOffset * xPositionOpenDrawer); openButton.setX(getScreenWidth() - (xPositionWindowContent + openButton.getWidth())); }
@Override
public void onDrawerOpened(View drawerView) {
super.onDrawerOpened(drawerView);
rightOpen.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.drawable.right_nav_drawable_close), null, null, null);
}
@Override
public void onDrawerClosed(View drawerView) {
super.onDrawerClosed(drawerView);
openButton.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.drawable.right_nav_drawable_open), null, null, null);
}
};
}
/*************************/ finally open and close drawer onclick of handle_to_open_drawer & handle_to_close_drawer using method drawerLayout.openDrawers() & drawerLayout.closeDrawers(); respectively
So instead of make this library to do that overlap, you can just use DrawerLayout