I used a layer of framelayout with a semi-translucent background to create an overlay. But this overlay doesn't block touch events to interact with the views below it. How should create an overlay that blocks all touch events?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- 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
If overlay doesn't get touch events, then the events are passed to underlying view, so to block touch events in views below it, make your overlay touchable.
android:clickable="true"
Improving the Blesson Jose answer, you need set the
android:focusable="true"
andandroid:clickable="true"
if you are using View to block the touch.put the button on overlay layer.then set that button android:background="@null" it block touch event of view below it..hope it solve your problem
Following code will add overlay on top of everything :
to block the touch event either you have to change the flag or below code will work:
For v1 you would do an import:
Then set the onTouchListener:
Below code has worked for me. I've added
android:clickable="true"
to block touch events to other views below it.This is an example with a ProgressBar inside the overlay. If you don't want the ProgressBar, you can use the FrameLayout without it.