I have an image, which can be moved around and scaled with pinch gesture.. All this is done inside onTouch()
. I want to restrict this and make it movable(and scalable) only after the user has done a longclick on the image.. How do I do this?
相关问题
- Views base64 encoded blob in HTML with PHP
- How can I create this custom Bottom Navigation on
- How to get the background from multiple images by
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Main idea of Roflcoptr is right, but even if you'll move your pointer without long click, onLongClick will be called. To avoid this, you can use this code:
Hope it will help someone )
You can create two View.ontouchlistener one for work and one empty, and set the listener to view only on onlongpress
Register a LongCLickListener. If a long click is recognized set a flag to true.
In the OnTouch method allow scaling and moving only if the flag is set to true. After the moving and scaling set the flag to false again.
Here is some pseudocode: