Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
223 views
in Technique[技术] by (71.8m points)

java - 处理onClick和双击(Handling onClick and double click)

I have a messaging app similar to whatsapp where there are messages videos and images in the chat activity.

(我有一个类似于whatsapp的消息传递应用程序,在聊天活动中有消息视频和图像。)

Now I want to implement a double tap like feature on this but the problem is I also have a onclicklistner attached to my image and video frame that opens up a fullscreenactivity showing the image in fullscreen or playing the video in fullscreen.

(现在,我想在其上实现双击之类的功能,但是问题是我还有一个onclicklistner附加到我的图像和视频框架上,从而打开了全屏活动,以全屏显示图像或以全屏播放视频。)

So on double tap instead of liking the picture or video it simply opens the video or image in the fullscreen mode.

(因此,双击而不是喜欢图片或视频,只需在全屏模式下打开视频或图像即可。)

Since in messages I don't have a onclick listner attached double tap like works fine.

(由于在邮件中我没有附加onclick列表器,因此双击双击效果很好。)

Any ideas on how I can make the double tap like work in case of the videos or images.

(关于如何在视频或图像情况下如何进行双击的任何想法。)

I am fairly new to android development using Java.

(我对使用Java进行android开发相当陌生。)

So any help is appreciated.

(因此,任何帮助表示赞赏。)

  ask by Aniruddha Chattopadhyay translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It is generally accepted to use long tap instead of double click in android apps.

(在Android应用程序中,通常使用长按而不是双击来接受。)

Try this:

(尝试这个:)

yourView.setOnLongClickListener(new View.OnLongClickListener() {
            @Override
            public boolean onLongClick(View view) {
                //do Your stuff here

                return true;
            }
        });

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...