Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid Button Place Image in center and text at bottom
    primarykey
    data
    text
    <p>I want to place Image in the center and text just below it in a button, I tried to set android:gravity but could not set it properly,here is the image attached:</p> <p><img src="https://i.stack.imgur.com/UJebt.png" alt="enter image description here"></p> <p>below is my xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:paddingLeft="10.0dip" android:paddingTop="10.0dip" android:paddingRight="10.0dip" android:paddingBottom="10.0dip" android:background="@drawable/background_img" &gt; &lt;LinearLayout android:layout_height="0dp" android:layout_width="match_parent" android:layout_weight="1" android:orientation="horizontal" android:paddingLeft="10.0dip" android:paddingTop="10.0dip" android:paddingRight="10.0dip" android:paddingBottom="10.0dip" &gt; &lt;Button android:layout_height="match_parent" android:layout_width="0dp" android:layout_weight="1" android:id="@+id/button_listen" android:text="@string/listen" android:drawableTop="@drawable/listen_btn" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_marginTop="10dp" android:layout_marginBottom="10dp" android:layout_gravity="center" /&gt; &lt;Button android:layout_height="match_parent" android:layout_width="0dp" android:layout_weight="1" android:id="@+id/button_gallery" android:text="@string/gallery" android:drawableTop="@drawable/gallery_btn" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_marginTop="10dp" android:layout_marginBottom="10dp" android:layout_gravity="center" /&gt; &lt;/LinearLayout&gt; &lt;LinearLayout android:layout_height="0dp" android:layout_width="match_parent" android:layout_weight="1" android:orientation="horizontal" android:paddingLeft="10.0dip" android:paddingTop="10.0dip" android:paddingRight="10.0dip" android:paddingBottom="10.0dip" &gt; &lt;Button android:layout_height="match_parent" android:layout_width="0dp" android:layout_weight="1" android:id="@+id/button_play" android:text="@string/play" android:drawableTop="@drawable/play_btn" android:layout_marginLeft="10dp" android:layout_gravity="center" android:layout_marginRight="10dp" android:layout_marginTop="10dp" android:layout_marginBottom="10dp" /&gt; &lt;Button android:layout_height="match_parent" android:layout_width="0dp" android:layout_weight="1" android:id="@+id/button_find" android:text="@string/find" android:drawableTop="@drawable/test_btn" android:layout_marginLeft="10dp" android:layout_marginRight="10dp" android:layout_marginTop="10dp" android:layout_marginBottom="10dp" android:layout_gravity="center" /&gt; &lt;/LinearLayout&gt; &lt;/LinearLayout&gt; </code></pre> <p>What is the proper way to center the image and text below it?</p> <p>Many thanks in advance.</p>
    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.
    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