Making a button easier to click

痴心易碎 提交于 2019-12-23 09:26:04

问题


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 "click box" than its visible area?


回答1:


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>



回答2:


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




回答3:


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?



来源:https://stackoverflow.com/questions/6898314/making-a-button-easier-to-click

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!