3

I want to add button left side of navigation drawer and when navigation drawer animated left the button should be move with navigation button and constained with navigation button enter image description here

enter image description here

Umar Hussain
  • 3,461
  • 1
  • 16
  • 38
hugerde
  • 919
  • 1
  • 12
  • 27
  • constrain button end to start of nav drawer? – Tim Jul 09 '19 at 13:39
  • Did you try to do it? :D – Vucko Jul 09 '19 at 13:40
  • @TimCastelijns yes – hugerde Jul 09 '19 at 13:40
  • @Vucko yes, and did you think about when writing this comment? – hugerde Jul 09 '19 at 13:42
  • 1
    And what happened? Include relevant XML and the behavior you got – Vucko Jul 09 '19 at 13:43
  • @Vucko when I arrange drawer layout is a root layout, it isn't imposible to constrained to right view. When I put constraint layout inside drawer layout the button stay right side. It isn't seen on the screen when right view invisible but I want to see button when right view invisible too – hugerde Jul 09 '19 at 13:54
  • I think you're going to have to hack around it a bit, but it shouldn't be too hard to do. You can use [this link](http://thetechnocafe.com/slide-content-to-side-in-drawer-layout-android/) to help you. It moves the whole content with the drawer, but you can tweak it slightly to move only 1 view. Good luck! – Vucko Jul 10 '19 at 09:14

1 Answers1

0

You can do it programmatically with your own logic. Like you can set a listener for your NavigationDrawer and detect position of the drawer, Here is the helping link.

Then you can reposition your button by setting its margins dynamically. You can do it in this way.

Asad Ali Choudhry
  • 4,985
  • 4
  • 31
  • 36
  • I tried this button moved together with right menu but there is a problem, button stay behind navigation view shadow. – hugerde Jul 09 '19 at 15:28