Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid sliding panels
    primarykey
    data
    text
    <p>I'm trying to start an application and I'm kind of lost on how to do what I want.</p> <p>This is what I want</p> <p><img src="https://i.stack.imgur.com/YI5Oh.png" alt="left and right red sliders ; main white content"></p> <p>Both red panels should be able to slide to the sides and the white one should expand if one of them (or both) them is collapsed, occupying that panel space. When I have the red panels on the screen, the white panel show all the content and not be under any of the panels.</p> <p>What have I tried so far: I started by trying with two <code>SlidingDrawer</code>s, but the white panel got behind the red ones, so, no luck there. After that I tried with 2 <code>LinearLayouts</code> (red panels) and a <code>RelativeLayout</code> (white panel), and tried to change width of the layouts with buttons (like is on the image on top). This caused always problems that I didn't know how to resolve.</p> <p>Suggestions?</p> <p>Edit: xml of the SlidingDrawer example:</p> <pre><code>&lt;LinearLayout android:id="@+id/LinearLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:gravity="bottom" android:background="#FFFFFFFF"&gt; &lt;SlidingDrawer android:layout_width="100dip" android:id="@+id/SlidingDrawer" android:handle="@+id/slideHandleButton" android:content="@+id/contentLayout" android:layout_height="fill_parent" android:orientation="horizontal"&gt; &lt;LinearLayout android:layout_width="wrap_content" android:id="@+id/contentLayout" android:orientation="horizontal" android:background="#C0C0C0" android:layout_height="wrap_content"&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:text="Meio" android:layout_toRightOf="@+id/buttonEsq" /&gt; &lt;/LinearLayout&gt; &lt;Button android:layout_width="30dip" android:layout_height="30dip" android:id="@+id/slideHandleButton" android:background="@drawable/arrowup"&gt; &lt;/Button&gt; &lt;/SlidingDrawer&gt; &lt;/LinearLayout&gt; </code></pre> <p>And the xml of the LinearLayout example:</p> <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" &gt; &lt;RelativeLayout android:id="@+id/relativeLayout1" android:layout_width="match_parent" android:layout_height="fill_parent" android:orientation="horizontal" android:layout_toLeftOf="@+id/linearLayout3" android:layout_toRightOf="@+id/linearLayout1" android:background="#FFFFFFFF"&gt; &lt;Button android:id="@+id/buttonEsq" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="v--" /&gt; &lt;TextView android:id="@+id/textView1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:gravity="center" android:text="Meio" android:layout_toRightOf="@+id/buttonEsq" /&gt; &lt;Button android:id="@+id/buttonDir" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@+id/textView1" android:text="--v" /&gt; &lt;/RelativeLayout&gt; &lt;LinearLayout android:id="@+id/linearLayout1" android:layout_width="50dip" android:layout_height="fill_parent" android:layout_alignParentLeft="true" android:background="#FFFF0000"&gt; &lt;TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Esquerda" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:id="@+id/linearLayout3" android:layout_width="50dip" android:layout_height="fill_parent" android:layout_alignParentRight="true" android:background="#FFF00000"&gt; &lt;TextView android:id="@+id/textView2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Direita" /&gt; &lt;/LinearLayout&gt; &lt;/RelativeLayout&gt; </code></pre> <p>The android code (the commented part is the code of the 1st example):</p> <pre><code>public class Main extends Activity { Button slideHandleButton; Button slideHandleButtonLeft; Button slideHandleButtonRight; SlidingDrawer slidingDrawer; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mainlayouts); /* slideHandleButton = (Button) findViewById(R.id.slideHandleButton); slidingDrawer = (SlidingDrawer) findViewById(R.id.SlidingDrawer); slidingDrawer.setOnDrawerOpenListener(new OnDrawerOpenListener() { @Override public void onDrawerOpened() { slideHandleButton.setBackgroundResource(R.drawable.arrowdown); } }); slidingDrawer.setOnDrawerCloseListener(new OnDrawerCloseListener() { @Override public void onDrawerClosed() { slideHandleButton.setBackgroundResource(R.drawable.arrowup); } });*/ slideHandleButtonLeft = (Button) findViewById(R.id.buttonEsq); slideHandleButtonLeft.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { LinearLayout lll = (LinearLayout) findViewById(R.id.linearLayout1); RelativeLayout.LayoutParams params=new RelativeLayout.LayoutParams(50, LinearLayout.LayoutParams.FILL_PARENT); lll.setLayoutParams(params); } }); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload