Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><code>android:gravity</code> handles the alignment of its children,</p> <p><code>android:layout_gravity</code> handles the alignment of itself.</p> <p>So use one of these.</p> <pre><code>&lt;LinearLayout 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" android:background="#000" android:baselineAligned="false" android:gravity="center" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".Main" &gt; &lt;LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" &gt; &lt;ImageView android:id="@+id/imageButton_speak" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/image_bg" android:src="@drawable/ic_speak" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_weight="1" android:gravity="center" &gt; &lt;ImageView android:id="@+id/imageButton_readtext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@drawable/image_bg" android:src="@drawable/ic_readtext" /&gt; &lt;/LinearLayout&gt; ... &lt;/LinearLayout&gt; </code></pre> <p>or</p> <pre><code>&lt;LinearLayout 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" android:background="#000" android:baselineAligned="false" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context=".Main" &gt; &lt;LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_weight="1" &gt; &lt;ImageView android:id="@+id/imageButton_speak" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:background="@drawable/image_bg" android:src="@drawable/ic_speak" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_width="0dp" android:layout_height="wrap_content" android:layout_gravity="center" android:layout_weight="1" &gt; &lt;ImageView android:id="@+id/imageButton_readtext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:background="@drawable/image_bg" android:src="@drawable/ic_readtext" /&gt; &lt;/LinearLayout&gt; ... &lt;/LinearLayout&gt; </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