Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8726235
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:12:27+00:00 2026-06-13T08:12:27+00:00

I’m currently using Nine Old Androids to animate a RelativeLayout like a slider menu,

  • 0

I’m currently using Nine Old Androids to animate a RelativeLayout like a slider menu, which slides down form the top. I’ve tried in many ways, Can someone make a suggestion?

Here is the animation code:

  private OnClickListener slideClick = new OnClickListener(){
    @Override
    public void onClick(View v) {
        slideGroups.bringToFront();

        if(!mPulledDown) {
            ObjectAnimator oa = ObjectAnimator.ofFloat(slideGroups, "translationY", slideGroups.getHeight()-80);
            oa.addListener(new AnimatorListener() {
                @Override
                public void onAnimationStart(Animator arg0) {}

                @Override
                public void onAnimationRepeat(Animator arg0) {}

                @Override
                public void onAnimationEnd(Animator arg0) {
                    arrow.setImageResource(R.drawable.arrowup);
                    if(Application.getAndroidAPILevel() < 11) {
                        // only if pre 3.0 (api level 11)
                        Toast.makeText(FriendsActivity.this, String.format("api level %s", 
                                Application.getAndroidAPILevel()), Toast.LENGTH_SHORT).show();
                        //RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) slideGroups.getLayoutParams();

                        // clear animation to prevent flicker
                        slideGroups.clearAnimation();

                        // set new "real" position of wrapper
                        RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, slideGroups.getWidth());
                        //lp.addRule(RelativeLayout.BELOW, R.id.branchFinderIncludeHeader);
                        slideGroups.setLayoutParams(lp);

                    }
                }

                @Override
                public void onAnimationCancel(Animator arg0) {}
            });
            oa.start();
        }
        else 
        {
            ObjectAnimator oa = ObjectAnimator.ofFloat(slideGroups, "translationY", 0);
            oa.addListener(new AnimatorListener() {
                @Override
                public void onAnimationStart(Animator arg0) {}

                @Override
                public void onAnimationRepeat(Animator arg0) {}

                @Override
                public void onAnimationEnd(Animator arg0) {
                    arrow.setImageResource(R.drawable.arrowdown);
                    if(Application.getAndroidAPILevel() < 11) {
                        // only if pre 3.0 (api level 11)
                        Toast.makeText(FriendsActivity.this, String.format("api level %s", 
                                Application.getAndroidAPILevel()), Toast.LENGTH_SHORT).show();
                    }
                }

                @Override
                public void onAnimationCancel(Animator arg0) {}
            });
            oa.start();
        }

        mPulledDown = !mPulledDown;         
    }
};

I just need something to work with sdk level 4 and newer. Currently, touching/tapping passes that event to the list underneath the slider when expanded. Please let me know if any other information is needed. slideGroups is the RelativeLayout. arrow is an imageview. groupsButton is a LinearLayout with text and an image button. groupsButton should be clickable; that’s what expands and is supposed to collapse it.

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T08:12:27+00:00Added an answer on June 13, 2026 at 8:12 am

    A few people have contributed by editing my question with solutions. I’d like to give them credit, but can’t upvote an edit. For posterity, here is the solution that works for me.

    int originalMarginLeft = 0;
    int originalMarginTop = 0;
    int originalMarginRight = 0;
    int originalMarginBottom = 0;
    int originalLeft = 0;
    int originalTop = 0;
    int originalRight = 0;
    int originalBottom = 0;
    int originalX = 0;
    int originalY = 0;
    int originalHeight = 0;
    
    private OnClickListener slideClick = new OnClickListener(){
        @Override
        public void onClick(View v) {
            slideGroups.bringToFront();
    
            if(originalMarginLeft == 0) {
                RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) slideGroups.getLayoutParams();
                originalMarginLeft = params.leftMargin;
                originalMarginTop = params.topMargin;
                originalMarginRight = params.rightMargin;
                originalMarginBottom = params.bottomMargin;
                originalLeft = slideGroups.getLeft();
                originalTop = slideGroups.getTop();
                originalRight = slideGroups.getRight();
                originalBottom = slideGroups.getBottom();
                originalHeight = params.height;
            }
    
            if(!mPulledDown) {
                ObjectAnimator oa = ObjectAnimator.ofFloat(slideGroups, "translationY", originalHeight);
                oa.addListener(new AnimatorListener() {
                    @Override
                    public void onAnimationStart(Animator arg0) {}
    
                    @Override
                    public void onAnimationRepeat(Animator arg0) {}
    
                    @Override
                    public void onAnimationEnd(Animator arg0) {
                        arrow.setImageResource(R.drawable.arrowup);
                        if(Application.getAndroidAPILevel() < 11) {
    
                            slideGroups.clearAnimation();
                            RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(slideGroups.getWidth(), slideGroups.getHeight());
                            lp.leftMargin = originalMarginLeft;
                            lp.rightMargin = originalMarginRight;
                            slideGroups.setLayoutParams(lp);
    
                        }
                    }
    
                    @Override
                    public void onAnimationCancel(Animator arg0) {}
                });
                oa.start();
            }
            else 
            {
                ObjectAnimator oa = ObjectAnimator.ofFloat(slideGroups, "translationY", -originalHeight+60);
                oa.addListener(new AnimatorListener() {
                    @Override
                    public void onAnimationStart(Animator arg0) {}
    
                    @Override
                    public void onAnimationRepeat(Animator arg0) {}
    
                    @Override
                    public void onAnimationEnd(Animator arg0) {
                        arrow.setImageResource(R.drawable.arrowdown);
                        if(Application.getAndroidAPILevel() < 11) {
    
                            slideGroups.clearAnimation();
                            RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(slideGroups.getWidth(), slideGroups.getHeight());
                            lp.leftMargin = originalMarginLeft;
                            lp.rightMargin = originalMarginRight;
                            lp.topMargin = originalMarginTop;
                            lp.bottomMargin = originalMarginBottom;
                            slideGroups.setLayoutParams(lp);
                        }
                    }
    
                    @Override
                    public void onAnimationCancel(Animator arg0) {}
                });
                oa.start();
            }
    
            mPulledDown = !mPulledDown;         
        }
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I have a text area in my form which accepts all possible characters from
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.