Note that there are some explanatory texts on larger screens.

plurals
  1. POBottom menu bar in LinearLayout
    primarykey
    data
    text
    <p>I am developing an application for Android and am having a bit of trouble formatting my bottom menu bar. I provided the relevant code for the menu bar with a picture of how it is rendering as well as a picture of how I would like it to be displayed.</p> <p>It seems as if my views are being centered even when I set android:layout_gravity to left or right. I have also tried android:gravity and have the same outcome.</p> <p><strong>Should I be using padding instead of the nested weights?</strong></p> <p><strong>What I have:</strong> <a href="http://imageshack.us/photo/my-images/607/have.png/" rel="nofollow">http://imageshack.us/photo/my-images/607/have.png/</a></p> <p><strong>What I want:</strong> <a href="http://imageshack.us/photo/my-images/600/wantb.png/" rel="nofollow">http://imageshack.us/photo/my-images/600/wantb.png/</a></p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ff000000" android:weightSum="25"&gt; /* *other layouts */ //layout for bottom menu bar &lt;LinearLayout android:id="@+id/menubar" android:layout_width="fill_parent" android:layout_height="0dp" android:background="#FFFFFF" android:layout_weight="1"&gt; &lt;ImageView android:layout_gravity="left" android:id="@+id/iv_previous" android:layout_width="0dp" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/left_trans" android:layout_weight="0.25"/&gt; &lt;ImageView android:gravity="left" android:id="@+id/iv_multi" android:layout_width="0dp" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/multi_trans" android:layout_weight="0.1"/&gt; &lt;ImageView android:gravity="left" android:id="@+id/iv_search" android:layout_width="0dp" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/search_trans" android:layout_weight="0.1"/&gt; &lt;ImageView android:gravity="left" android:id="@+id/iv_pen" android:layout_width="0dp" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/pen_trans" android:layout_weight="0.1"/&gt; &lt;ImageView android:gravity="left" android:id="@+id/iv_highlighter" android:layout_width="0dp" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/highlighter_trans" android:layout_weight="0.1"/&gt; &lt;ImageView android:gravity="left" android:id="@+id/iv_tag" android:layout_width="0dp" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/tag_trans" android:layout_weight="0.1"/&gt; &lt;ImageView android:layout_gravity="right" android:id="@+id/iv_next" android:layout_width="0dp" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/right_trans" android:layout_weight="0.25"/&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p><strong>EDIT</strong> (Using RelativeLayout --> not working):</p> <pre><code>&lt;RelativeLayout android:id="@+id/menubar" android:layout_width="fill_parent" android:layout_height="0dp" android:background="#FFFFFF" android:layout_weight="1"&gt; &lt;ImageView android:layout_alignParentLeft="true" android:id="@+id/iv_previous" android:layout_width="0dp" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/left_trans" /&gt; &lt;ImageView android:id="@+id/iv_next" android:layout_alignParentRight="true" android:layout_width="0dp" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/right_trans" /&gt; &lt;ImageView android:id="@+id/iv_multi" android:layout_toRightOf="@id/iv_previous" android:layout_width="0dp" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/multi_trans" /&gt; &lt;ImageView android:id="@+id/iv_search" android:layout_toRightOf="@id/iv_multi" android:layout_width="0dp" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/search_trans" /&gt; &lt;ImageView android:id="@+id/iv_tag" android:layout_toLeftOf="@id/iv_next" android:layout_width="0dp" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/tag_trans" /&gt; &lt;ImageView android:id="@+id/iv_highlighter" android:layout_toLeftOf="@id/iv_tag" android:layout_width="0dp" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/highlighter_trans" /&gt; &lt;ImageView android:id="@+id/iv_pen" android:layout_toLeftOf="@id/iv_highlighter" android:layout_width="0dp" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/pen_trans" /&gt; &lt;/RelativeLayout&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    1. This table or related slice is empty.
    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