Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid custom button sensitivity
    text
    copied!<p>I have created a custom button like this :</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_focused="false" android:state_pressed="false"&gt; &lt;shape&gt; &lt;gradient android:endColor="@color/title_dark_red" android:startColor="@color/title_red" android:angle="270" /&gt; &lt;stroke android:width="1dp" android:color="@color/red_stroke" /&gt; &lt;corners android:radius="3dp" /&gt; &lt;padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /&gt; &lt;/shape&gt; &lt;/item&gt; &lt;item android:state_focused="true" android:state_pressed="true"&gt; &lt;shape&gt; &lt;gradient android:endColor="@color/title_pressed_red" android:startColor="@color/title_pressed_red" android:angle="270" /&gt; &lt;stroke android:width="1dp" android:color="@color/red_stroke" /&gt; &lt;corners android:radius="3dp" /&gt; &lt;padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /&gt; &lt;/shape&gt; &lt;/item&gt; &lt;item android:state_focused="false" android:state_pressed="true"&gt; &lt;shape&gt; &lt;gradient android:endColor="@color/title_pressed_red" android:startColor="@color/title_pressed_red" android:angle="270" /&gt; &lt;stroke android:width="1dp" android:color="@color/red_stroke" /&gt; &lt;corners android:radius="3dp" /&gt; &lt;padding android:left="10dp" android:top="10dp" android:right="10dp" android:bottom="10dp" /&gt; &lt;/shape&gt; &lt;/item&gt; &lt;/selector&gt; </code></pre> <p>The problem is sensitivity of the button is very bad, not like the regular buttons. The buttons are not too small in the screen, so it's easy to touch.</p> <p>What can be the problem ?</p> <p>P.S I'm using Button.OnClickListener() to set click handler.</p> <p>Button is in relative layout structure :</p> <p> <pre><code>android:focusable="true" android:focusableInTouchMode="true" android:orientation="vertical" &gt; </code></pre> <p> </p> <pre><code> &lt;TextView android:id="@+id/titlePlace" android:layout_width="wrap_content" android:layout_height="40dp" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" android:background="@drawable/expand_bg" android:gravity="center_vertical" android:text="" android:textColor="@color/titletextcolor" android:textSize="18sp" android:textStyle="bold" /&gt; &lt;Button android:id="@+id/backButton" android:layout_width="wrap_content" android:layout_height="30dp" android:layout_alignBaseline="@+id/showButton" android:layout_alignBottom="@+id/showButton" android:layout_alignParentLeft="true" android:background="@drawable/custom_button_back" android:layout_marginLeft="5dip" android:paddingBottom="5dp" android:paddingTop="5dp" android:text="Places" android:textColor="@color/white" android:textSize="12sp" android:textStyle="bold" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p></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