在 Intent.ACTION_PICK 的图库中,我可以覆盖 longClick 吗?
在我的应用程序中,我让用户从媒体库中选择一张图像。为此,我使用 Intent.ACTION_PICK。 就像
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent, IMAGE_PICK);
该应用程序大部分工作正常一样,用户可以正确选择图像和 uri。
事情在画廊里。如果用户点击图像,一切顺利,图像将被选择并返回 uri。 但如果用户长时间点击图像,无论是意外还是故意,手机会瞬间振动,图像聚焦,然后什么也不会发生。 据我所知,在正式的图库应用程序上,这会弹出一个菜单,但在这种情况下,它什么也不做,并且可能会让用户感到困惑,认为他们点击了,看到应用程序什么也不做。
所以问题是,我可以做些什么来改变该屏幕中长按的行为吗?比如覆盖 onLongClick
或设置 onLongClickListener
之类的?
预先感谢,最诚挚的问候。
In my app i let the user select one image from the media gallery. To do this i use the Intent.ACTION_PICK.
Like
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("image/*");
startActivityForResult(intent, IMAGE_PICK);
The app works mostly fine, the users can select an image and the uri correctly.
The matter is in the gallery. If the user does a tap on an image all goes well, image is selected and uri returned.
But if the user does a long click on an image, be it accident or on purpose, the phone vibrates a split sec, the image is focused, and then nothing happens.
I understand on the formal gallery app this brings up a menu, but in this case it does nothing, and it can be confusing to users, to think they tapped and see the app do nothing.
So the question is, can i do anything to change the behavior of the long click in that screen? Like override the onLongClick
or set an onLongClickListener
or something?
Thanks in advance, best regards.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,您可以同时执行两者, < strong>
onLongClick
是方法和onLongClickListener
是该方法的回调。Yes you can do both,
onLongClick
is the method andonLongClickListener
is the callback for that method.