Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid custom button margin
    text
    copied!<p>I have a custom button layout </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:state_pressed="true"&gt; &lt;shape&gt; &lt;gradient android:startColor="@color/pres1" android:endColor="@color/pres2" android:angle="270" /&gt; &lt;stroke android:width="5dp" android:color="@color/stro3" /&gt; &lt;corners android:radius="5dp" /&gt; &lt;padding android:left="10dp" android:top="20dp" android:right="10dp" android:bottom="20dp" /&gt; &lt;/shape&gt; &lt;/item&gt; &lt;item android:state_focused="true"&gt; &lt;shape&gt; &lt;gradient android:endColor="@color/focu1" android:startColor="@color/focu2" android:angle="270" /&gt; &lt;stroke android:width="5dp" android:color="@color/stro2" /&gt; &lt;corners android:radius="5dp" /&gt; &lt;padding android:left="10dp" android:top="20dp" android:right="10dp" android:bottom="20dp" /&gt; &lt;/shape&gt; &lt;/item&gt; &lt;item&gt; &lt;shape&gt; &lt;gradient android:endColor="@color/norm1" android:startColor="@color/norm2" android:angle="270" /&gt; &lt;corners android:radius="5dp" /&gt; &lt;padding android:left="10dp" android:top="20dp" android:right="10dp" android:bottom="20dp" /&gt; &lt;/shape&gt; &lt;/item&gt; &lt;/selector&gt; </code></pre> <p>And for the below lay out </p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@color/all_white"&gt; &lt;TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/hello" android:textColor="@color/all_red" /&gt; &lt;Button android:id="@+id/mq_categories" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Browse Quiz Categories" android:background="@drawable/custom_button" /&gt; &lt;Button android:id="@+id/mq_random" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="Enter Random Quiz" android:background="@drawable/custom_button" /&gt; &lt;/LinearLayout&gt; </code></pre> <p>following output is generated</p> <p><img src="https://i.stack.imgur.com/FESrl.png" alt="alt text"></p> <p>I need to add some margin between buttons, Any help appreciated..</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