Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid RelativeView - button disappears
    text
    copied!<p>Been trying to create a layout similar to the Android Facebook app (top bar with app name and 2 buttons aligned right).</p> <p>Tried everything :( the closest I got made one of the buttons disappear...</p> <p>Here is the code: (using relatives on top to create sticky header and footer)</p> <p>the "Add" button disappears while the "Search" button aligns to the right.</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="wrap_content" android:layout_height="wrap_content" android:orientation="vertical"&gt; &lt;RelativeLayout android:layout_width="fill_parent" android:layout_height="50dip" android:id="@+id/top_control_bar"&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/top_background"&gt; &lt;TextView android:layout_width="wrap_content" android:layout_height="20dip" android:text="APP" android:layout_gravity="left|center" android:layout_alignParentLeft="true" android:layout_toLeftOf="@+id/add_bookmark" /&gt; &lt;Button android:id="@+id/add_bookmark" android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="Add" android:layout_gravity="right|center" android:layout_alignParentRight="true" /&gt; &lt;Button android:id="@+id/search_bookmark" android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="Search" android:layout_gravity="right|center" android:layout_alignParentRight="true" /&gt; &lt;/RelativeLayout&gt; &lt;/RelativeLayout&gt; &lt;LinearLayout android:id="@+id/bottom_control_bar" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentBottom="true"&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="Backup" /&gt; &lt;Button android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="Restore" /&gt; &lt;/LinearLayout&gt; &lt;ListView android:id="@android:id/list" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_below="@id/top_control_bar" android:layout_above="@id/bottom_control_bar"&gt;&lt;/ListView&gt; &lt;TextView android:id="@android:id/empty" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="No Bookmarks found. You can add one by clicking the star." android:layout_below="@id/top_control_bar" android:layout_above="@id/bottom_control_bar" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>Would appreciate any help! :)</p>
 

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