Hi in my app contain a Button ,currently i customized using xml for changing the background and it work fine in 2.1 but when am reach to 2.2 ,The button is hard to hit ,how can i solve the issue?
my button xml code given below
<Button
android:id ="@+id/Button_Continue1"
android:background="@drawable/continue_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
/>
If your button is small and hard to hit use an Inset Drawable. You set the drawable you want to have displayed and the inset on the left, top, right and bottom. The inset is like some kind of margin but clickable.
Here is an example.
<?xml version="1.0" encoding="UTF-8"?>
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@drawable/your_drawable"
android:insetTop="10dp"
android:insetRight="10dp"
android:insetBottom="10dp"
android:insetLeft="10dp"/>
That will make your button to be 10dp
taller on every side for touch events. The look of your button will not change.
Now in your layout you don't set your original drawable as the Button
's background anymore but the new Inset Drawable
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With