Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><code>TextView</code> holding <code>Top Text</code> should be a part of SlidingDrawer. Currently it is not. Also, you have identical <code>ids</code> defined for top text and bottom text. I have changed that. See if the following fixes the issue:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" &gt; &lt;SlidingDrawer android:id="@+id/SlidingDrawer" android:layout_width="fill_parent" android:layout_height="fill_parent" android:content="@+id/contentLayout" android:handle="@+id/contentLayoutTop" &gt; &lt;LinearLayout android:layout_width="wrap_content" android:id="@+id/contentLayoutTop" android:layout_height="wrap_content" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/textViewInTransitTop" android:text="Top Text" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;Button android:id="@+id/slideHandleButton" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center" android:text="Slider" &gt; &lt;/Button&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="wrap_content" android:id="@+id/contentLayout" android:layout_height="wrap_content"&gt; &lt;TextView android:id="@+id/textViewInTransit" android:text="Bottom Text" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;/LinearLayout&gt; &lt;/SlidingDrawer&gt; &lt;/RelativeLayout&gt; </code></pre> <p>If you need the top text before (or after) <code>@+id/slideHandleButton</code>, change the order in which they are defined. If you need the button in line with the text, move the button declaration inside that LinearLayout that holds top text.</p> <p><strong>Edit:</strong></p> <blockquote> <p>It would be nice if the answer was xml only.</p> </blockquote> <p>I tried staying within your requirements, but this cannot be done in xml alone. Fortunately, the code part is straightforward:</p> <p>In your activity's <code>onCreate(Bundle)</code>:</p> <pre><code>SlidingDrawer slidingDrawer = (SlidingDrawer) findViewById(R.id.SlidingDrawer); final TextView textViewInTransitTop = (TextView) findViewById(R.id.textViewInTransitTop); slidingDrawer.setOnDrawerOpenListener(new OnDrawerOpenListener() { @Override public void onDrawerOpened() { // Drawer's been opened // Don't use View.INVISIBLE textViewInTransitTop.setVisibility(View.GONE); } }); slidingDrawer.setOnDrawerCloseListener(new OnDrawerCloseListener() { @Override public void onDrawerClosed() { // Text on top is back again textViewInTransitTop.setVisibility(View.VISIBLE); } }); </code></pre>
 

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