Can I increase a buttons onclick-area programmatically?

后端 未结 8 1983
孤独总比滥情好
孤独总比滥情好 2021-02-01 16:34

Sometimes I have a button in my UI that it is so small that it is difficult to click. My solution so far has been to add a transparent border around the button in photoshop. Jus

8条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-01 16:49

    I have just found a neat way to solve this problem.

    1. Surround the button with a say a LinearLayout that has the padding round the button.
    2. Add the same onclick to the LinearLayout as the Button.
    3. In the Button set the duplicateParentState to true which make the button highlight when you click outside the button but inside the LinearLayout.

      
          

提交回复
热议问题