开发者

OnTouch/OnClick listeners. Use both?

开发者 https://www.devze.com 2023-03-17 06:02 出处:网络
I have a short question. Should I use in same time OnTouch and OnClick listeners ? If I`m correct one is for touch screens and other开发者_StackOverflow中文版 is for devices with out it. Am I wrong ?

I have a short question. Should I use in same time OnTouch and OnClick listeners ? If I`m correct one is for touch screens and other开发者_StackOverflow中文版 is for devices with out it. Am I wrong ? If not should I use both listeners to secure both kind of devices ?


You only need OnTouch if you have some event that should only happen with a touch screen. If you just want to do something when the user taps (or clicks), then you only need OnClick.


I use both. I've create a class extending from Button class. I've put my custom appearance and interaction (programmaticaly) on the onTouch() method and the functionality for the onClick().

0

精彩评论

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