android - How to shift parent layout to right without changing inner components layout? -


in application want have sliding menu on left side facebook.

in previous question had raised concern regarding same , this answer found way slide layout right using this library. but, found that, library not slides layout, instead takes screenshot , slides image towards right components on layout not clickable. , need components clickable. so, tried new way of achieving putting slideout menu on left keeping default visibility view.gone , make visible on click on left top corner "show/hide menu" button shown in figure below.

layout before:

layout before clicking show/hide menu button

now when click "show/hide menu" button, layout like-

layout after:

layout after clicking show/hide menu button

as can see, layout on right shrinks , button "some other view" changes width if i've set android:minwidth attribute 2 buttons on right parent relativelayout.

so question is, is there way shift layout towards right without inner components changing width/layout? in whatever area available view, filled whatever portion of content can filled in in area.

this problem can solved this:

  • create framelayout inside: first left menu 3 buttons , second layout contains other 2 buttons (show/hide , other view). way, second layout in front of menu (since fill_parent).

  • in onclick of show/hide button perform translate animation: assuming menu 200px wide, move second layout 200 right.

  • in onanimationend, set margins second layout this: secondlayoutlayoutparams.setmargins(200, 0, -200, 0);

closing menu similar: move second layout left 200 , set margins 0.

by setting margins avoid button shrinking.

hope helps


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c++ - Using OpenSSL in a multi-threaded application -

All overlapping substrings matching a java regex -