How to shift a LinearLayout when a SlidingDrawer expands?
<p>I am trying to implement a panel in a fragment that can expand on button click from the right side of the screen. I can't use the navigation drawer, because I already have navigation drawers from both left and right sides.</p>

<p>The idea is to achieve something like that:</p>

<p><a href="https://i.stack.imgur.com/Ch0ns.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ch0ns.png" alt="enter image description here"></a></p>

<p>I was almost able to do it with the <code>SlidingDrawer</code> widget (it's deprecated..), the only problem is that I don't know how to make the LinearLayout to appear in the middle and then to shift when the button to expand the <code>SlidingDrawer</code> is clicked.</p>

<p>I have the following code:</p>

<pre><code>public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Button handle = (Button) findViewById(R.id.handle);
        SlidingDrawer drawer = (SlidingDrawer) findViewById(R.id.slidingDrawer);

        drawer.setOnDrawerOpenListener(new SlidingDrawer.OnDrawerOpenListener() {
            @Override
            public void onDrawerOpened() {
            }
        });

        drawer.setOnDrawerCloseListener(new SlidingDrawer.OnDrawerCloseListener() {
            @Override
            public void onDrawerClosed() {
            }
        });
    }
}
</code></pre>

<p>And the <code>XML</code> code:</p>

<pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.test.slidingdrawertest.slidingdrawertest.MainActivity"&gt;

    &lt;LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:gravity="center"
        android:orientation="vertical"&gt;

        &lt;TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="TEST TEST TEST" /&gt;

    &lt;/LinearLayout&gt;

    &lt;LinearLayout
        android:layout_alignParentEnd="true"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"&gt;


        &lt;SlidingDrawer
            android:id="@+id/slidingDrawer"
            android:layout_width="200dp"
            android:layout_height="400dp"
            android:layout_marginTop="100dp"
            android:layout_gravity="end"
            android:content="@+id/content"
            android:handle="@+id/handle"
            android:orientation="horizontal"&gt;

            &lt;Button
                android:id="@+id/handle"
                style="?android:attr/borderlessButtonStyle"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Expand" /&gt;

            &lt;LinearLayout
                android:id="@+id/content"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:orientation="vertical"&gt;

                &lt;TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="TEST TEST TEST" /&gt;

            &lt;/LinearLayout&gt;

        &lt;/SlidingDrawer&gt;

    &lt;/LinearLayout&gt;

&lt;/RelativeLayout&gt;
</code></pre>