Note that there are some explanatory texts on larger screens.

plurals
  1. PORemove text padding in Button view
    text
    copied!<p>I would like to remove the padding around text in Button view. The first screenshot is the result I would achieve, and the second one is the state of the art.</p> <p><img src="https://i.stack.imgur.com/ZXJBn.png" alt="enter image description here"></p> <p><img src="https://i.stack.imgur.com/Yy3nT.png" alt="enter image description here"></p> <p>Of course, I have defined a custom drawable to get the button appearance. But even if I set the padding attribute to 0dp the result does not change.</p> <p>Any suggestion, please?</p> <p><strong>EDIT</strong> Here is the xml code of the button</p> <pre><code>&lt;Button android:id="@+id/btnCancel" style="@style/dark_header_button" android:layout_width="wrap_content" android:layout_marginLeft="10dp" android:layout_height="wrap_content" android:includeFontPadding="false" android:padding="0dp" android:layout_alignParentLeft="true" android:layout_centerVertical="true" android:text="@android:string/cancel" /&gt; </code></pre> <p>Here is the style xml file:</p> <pre><code>&lt;style name="dark_header_button"&gt; &lt;item name="android:background"&gt;@drawable/bkg_dark_header_button&lt;/item&gt; &lt;item name="android:shadowDy"&gt;-1&lt;/item&gt; &lt;item name="android:shadowColor"&gt;#000000&lt;/item&gt; &lt;item name="android:shadowRadius"&gt;1&lt;/item&gt; &lt;item name="android:textSize"&gt;14sp&lt;/item&gt; &lt;item name="android:textColor"&gt;#ffffff&lt;/item&gt; &lt;/style&gt; </code></pre> <p>and here is the drawable xml file:</p> <pre><code>&lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:state_pressed="true"&gt; &lt;shape&gt; &lt;corners android:radius="10dp" /&gt; &lt;gradient android:angle="90" android:endColor="#060606" android:startColor="#707070" android:type="linear" /&gt; &lt;/shape&gt; &lt;/item&gt; &lt;item&gt; &lt;shape&gt; &lt;corners android:radius="10dp" /&gt; &lt;gradient android:angle="90" android:endColor="#707070" android:startColor="#060606" android:type="linear" /&gt; &lt;stroke android:width="0.5dp" android:color="#2b2b2b" /&gt; &lt;/shape&gt; &lt;/item&gt; &lt;/selector&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