Android: Invisible objects still clickable

后端 未结 6 643
小蘑菇
小蘑菇 2021-01-17 11:28

I have an activity that has buttons and images that can appear and disappear depending on user interactions.

What I am finding is that objects at the back, which hav

6条回答
  •  日久生厌
    2021-01-17 11:50

    Making any View invisible don't prevent us to trigger their listeners. It's just you can not see it every other thing would be same as if it was visible.

    If you don't want to use it at all change it to View.GONE

    Difference in View.INVISIBLE and View.GONE: Invisible objects keep on utilizing the space assigned to it while object set as View.GONE would leave the space of space as if its not on screen.

    Use

    object.setVisibility(View.GONE);
    

    rather than

    object.setVisibility(View.INVISIBLE);
    

提交回复
热议问题