android setOnLongClickListner不适用于onTouch事件

编程入门 行业动态 更新时间:2024-10-21 06:05:53
本文介绍了android setOnLongClickListner不适用于onTouch事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个可拖动和缩放的图像视图但现在我还需要在我的图像视图上放置setOnLongClickListner。我已经做到了,但它不起作用。但当我禁用ontouch事件时,它开始工作。请有人告诉我如何解决这个问题。 这里是我的代码

i have a image view which is drag able and zoom able but now i also need to put setOnLongClickListner on my image view. i have done that but it is not working. but when i disabled the ontouch event it started working. can anybody tell me please how to fix that. here is my code

image.layout(0, 30, screenWidth, screenHeight - 30); image.setScaleType(ImageView.ScaleType.FIT_XY); params = new RelativeLayout.LayoutParams(screenWidth, screenHeight - 30); params.leftMargin = 0; params.topMargin = 30; layout.addView(image, params); image.setOnLongClickListener(new View.OnLongClickListener() { public boolean onLongClick(View v) { Log.i("its working", "its working"); return true; } }); image.setOnTouchListener(this);

i,非常感谢。

非常感谢。

推荐答案

我认为Object可以有onClick或onTouch,它会使用任何最后一个定义是。我最近在一些应用程序中也注意到了这一点。

I think that the Object can have either an onClick or an onTouch, and it will use whatever the last one defined is. I have noticed this recently in some of my apps too.

更多推荐

android setOnLongClickListner不适用于onTouch事件

本文发布于:2023-11-23 14:02:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1621696.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不适用于   事件   android   setOnLongClickListner   onTouch

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!