0

I have framelayout which contains two relative layouts, one is on top of the other. When user clicks a button, the one on the top move 80% off the screen to the right. Then one on the bottom becomes clickable. This is what it looks like.

                                 FrameLayout
          RelativeLayout (bottom)              RelativeLayout (top)
            FilterWidgets                   Open/close button, ListView

It's really easy to achieve on 3.0+ with the new animation api which is Property base Animation. For the pre 3.0, because animation is view based. So I end up manually modify the layout property on onAnimationEnd. The call requestLayout to make it permanent, but only to find out the layout reverts back to original position. Anybody know how to move layout permanently?

see my other post if you want to see the whole picture: https://stackoverflow.com/questions/14541265/changecursor-cause-layout-container-of-the-listview-to-reposition

theTranslationX.addListener(new AnimatorListenerAdapter() {

                    @Override
                    public void onAnimationEnd(Animator nullPointer) {
                        v.clearAnimation();
                        int theL = isMenuOn() ? 0 : v.getLeft() + getFilterWidth();
                        int theR = isMenuOn() ? v.getWidth() : v.getLeft() + getFilterWidth() + v.getWidth();
                        int theHeight = v.getHeight();
                        int theT = 0;
                        v.layout(theL, theT, theR, theHeight);
                        v.requestLayout();
                    }
                });
Community
  • 1
  • 1

1 Answers1

0

This is 9 months late but try using:

yourView.layout(left,top,right,bottom); //all parameters are type int

However I don't think this is permanent, the position of the view will still be reset when you call requestLayout(), but give it a try.

what is sleep
  • 916
  • 4
  • 12