SlidingMenu icon indicating copy to clipboard operation
SlidingMenu copied to clipboard

How to overlap slidingMenu over MainActivity

Open akashk1992 opened this issue 9 years ago • 3 comments

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?

akashk1992 avatar Nov 02 '15 14:11 akashk1992

I have the same question, how can I do that :) ?

piotrros avatar Nov 16 '15 21:11 piotrros

<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

akashk1992 avatar Dec 15 '15 16:12 akashk1992

So instead of make this library to do that overlap, you can just use DrawerLayout

hendrawd avatar Jul 13 '16 07:07 hendrawd