OnTouchEvent not working on child views

前端 未结 7 1915
梦如初夏
梦如初夏 2020-11-29 21:45

I have a Linear Layout that has a Button and a TextView on it. I have written a OnTouchEvent for the activity. The code works fine if I touch on the screen, but if I touch t

7条回答
  •  难免孤独
    2020-11-29 22:19

    you can also try onUserInteraction():

    @Override 
    public void onUserInteraction(){
         //your code here
         super.onUserInteraction();
    }
    

    works well for me!

提交回复
热议问题