OnTouchListener和OnClickListener的区别区别、OnTouchListener、OnClickListener

2023-09-05 01:35:33 作者:很好很强大

我做了一个应用程序implemements视图OnTouchListener。当我上传到了市场,我得到以下信息:

I made an app which implemements a View OnTouchListener. When I uploaded it to the Market, I get the following message:

This apk requests 1 features that will be used for Android Market filtering
android.hardware.touchscreen

我真的不需要触摸屏本身。您还可以点击的说法,这将是罚款。而是采用了OnTouchListener如果我用了OnClickListener,将这一要求离开?

I really don't need a touchscreen per se. You could also "click" the view and this would be fine. If instead of using the OnTouchListener, I used the OnClickListener, would this requirement go away?

没有多大比例的Andr​​oid设备的触摸屏?如果此更新从OnTouchListener到OnClickListener成为新的潜在用户方面有所作为?

What percentage of Android devices do not have a touch screen? Should this update from OnTouchListener to OnClickListener be something worthwhile in terms of new potential users?

谢谢!

推荐答案

OnTouchListener是更精细的控制比OnClickListener。如果你真的关心的是点击 - 也就是说,对组合下的触摸/向上触摸/不拖 - 再使用OnClickListener,这是它的目的。

OnTouchListener is for more fine-grained control than OnClickListener. If what you really care about is clicks -- i.e., the combination of of down-touch/up-touch/no-drag -- then use OnClickListener, that's its purpose.

 
精彩推荐
图片推荐