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 6931775
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:37:16+00:00 2026-05-27T11:37:16+00:00

I’m attempting to replicate the Facebook app’s new menu slider. Creating a slider that

  • 0

I’m attempting to replicate the Facebook app’s new menu slider. Creating a slider that comes in from the left is easy enough. However, the Facebook app takes the Activity’s layout and slides it right, with only a small part of its left edge still showing on the right side of the screen. I’m a bit confused about how to do this. Does anyone have any ideas?

This best thing I can think of, which I have not tried, is to use the Display class to determine the width of the screen, set the width of the outer-most View to that and display it to the right of the slider (obviously wrapped by a RelativeView).

Update: I’ve tried the following.

My outer-most View is a RelativeLayout. Inside this RelativeLayout there are two sibling Views. Both of them are LinearLayouts. The first one is a layout containing the side bar (in my XML, this is accomplished through an include). The second one, which sits on top, is a layout containing the main body of the Activity (the screen as I want the user to normally see it).

Here is my XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/black" >

    <include
        android:id="@+id/mainnew_slider"
        layout="@layout/layout_slidermenu" />

    <LinearLayout
        android:id="@+id/mainfeed_mainlayout"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:background="@drawable/loginbg"
        android:orientation="vertical" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="64dip"
            android:background="@drawable/titlebar_background"
            android:orientation="vertical"
            android:padding="4dip" >

            <ImageButton
                android:id="@+id/mainfeed_slider"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:background="@drawable/selector_titlebar_button"
                android:src="@drawable/sidebarico" />
        </LinearLayout>

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="1dip"
            android:background="@color/store_toolbar_bottom_border" />
    </LinearLayout>

</RelativeLayout>

When the user clicks the ImageButton, I use some animation code to make the main layout move to the right. The code I use to animation the main layout is:

        AnimationSet set = new AnimationSet(true);
        Animation animation = new TranslateAnimation(
            Animation.RELATIVE_TO_PARENT, 0.0f,Animation.RELATIVE_TO_PARENT, 1.0f,
            Animation.RELATIVE_TO_PARENT, 0.0f,Animation.RELATIVE_TO_PARENT, 0.0f
        );
        animation.setDuration(1000);
        set.addAnimation(animation);

        LayoutAnimationController controller = new LayoutAnimationController(set, 0.0f);
        LinearLayout main = (LinearLayout) findViewById(R.id.mainfeed_mainlayout);
        main.setLayoutAnimation(controller);

When I click the slider button, the two children of the main layout slide to the right, but not the main layout itself (its background stays static). When the animation is complete, everything snaps back to its original position.

I don’t understand why it’s not moving the whole main layout and keeping it at its resting place.

  • 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-05-27T11:37:17+00:00Added an answer on May 27, 2026 at 11:37 am

    A simple TranslateAnimation applied to your top-level view should do it. Don’t do it via layout, it’ll be way too slow.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
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 have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I am currently running into a problem where an element is coming back from
We're building an app, our first using Rails 3, and we're having to build

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.