FrameLayout: is it possible to put child layout off-screen?

is it possible to have structure like the one below. And have LinearLayout that is at front to be off screen:

<FrameLayout>

   <LinearLayout>
   .. Back Layout
   </LinearLayout>

   <LinearLayout>
   .. Front layout
   </LinearLayout>

</FrameLayout>

Here is the image. What I have tried: I have tried setting android:layout_marginLeft="-300dp" for LinearLayout A (front), but as soon as I test it on my phone the A layout is back inside of visible area. I have also tried pushing the A layout off the screen with TranslateAnimation, after animation ends A layout is back inside of visible area.

Please help me solve the problem. Thank you.

Answers


So in case anyone needs something like this here how I solved it. Sliding menu on top of content. Layout structure as described in the question. Here is a simple animation in xml: show_menu.xml

<?xml version="1.0" encoding="utf-8"?>

<set
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="false">
    <translate
        android:fromXDelta="-100%" 
        android:toXDelta="0%"
        android:duration="400">
    </translate>
</set>

hide_menu.xml:

<?xml version="1.0" encoding="utf-8"?>
<set
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="false">
    <translate
        android:fromXDelta="0%" 
        android:toXDelta="-100%"
        android:duration="400">
    </translate>
</set>

in MyActivity

//loading hide animation and setting listener.
anim = AnimationUtils.loadAnimation(this, R.anim.hide_menu); 
    anim.setAnimationListener(new Animation.AnimationListener() {

        @Override
        public void onAnimationStart(Animation animation) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onAnimationRepeat(Animation animation) {
            // TODO Auto-generated method stub

        }
        //on animation end setting visibility to gone
        @Override
        public void onAnimationEnd(Animation animation) {
            // TODO Auto-generated method stub
            MenuList.setVisibility(View.GONE);
        }
    });

Same thing is done for animation for show_menu animtaion except it would have onAnimationStart setting visibilty to visible. MenuList in the code is A layout from the figure in the question.

Update: *The best way to do a sliding menu today is to use the DrawerLayout.*


Need Your Help

Single Page Application Organization

javascript css angularjs single-page-application

Coming from the world of rendering views on the server-side, I can't quite get it to click in my head how to organize the CSS of a single page javascript application. I'm using AngularJS in this

Event gets deleted from queue when posted to window in Qt

c++ qt events

I am trying to send a KeyPress Event to my window application:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.