开发者

Making a button easier to click

I have a button that on certain phones is too hard to click because of its size.

But making it bigger breaks layout.

It is possible to explain to a view that it has a bigger "cli开发者_如何学JAVAck box" than its visible area?


Not sure if this can help:

If you use an ImageButton with no background and you set a Padding value, your button will have a larger clickable area.

<ImageButton android:layout_width="wrap_content" android:layout_height="wrap_content" 
    android:src="@drawable/img_close" android:id="@+id/btnClose" 
    android:padding="25dip" android:background="#0000"></ImageButton>


Propably the best thing would be to create a layout for each density / screen size.


Not sure if it helps in your particular case, but you can make a Linear/RelativeLayout take clicks (setClickable()). So you may be able to enable clicks on the Button's parent and obtain your desired effect?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜