How to create an overlay that blocks touch events to UI below it?

前端 未结 5 1445
伪装坚强ぢ
伪装坚强ぢ 2021-02-05 17:27

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 sho

5条回答
  •  情歌与酒
    2021-02-05 18:14

    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.

    
    
                
    
    
    

提交回复
热议问题