Android: Invisible objects still clickable

后端 未结 6 604
小蘑菇
小蘑菇 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:49

    The only way I managed to solve this ridiculous issue was to create a sort of view panel that sits between the objects in my activity. This view panel is the size of the screen, uses the same colour background, and starts invisible.

    Normally, I make object A disappear, and make object B appear. When I click the space previously occupied by object A, it momentarily flashes back onto the screen and then disappears again. It looks terrible. Subsequent clicks do not reproduce this bug until the next time I make object A disappear.

    The fix is to make object A disappear, make the new view panel visible on top of it, and then make object B appear on top of the view panel. So the panel acts as a sort of barrier between the hidden object, and user interactions. The user is not aware that this view panel even exists, as it blends in to the standard background, but when I now click the space where object A would be, it now no longer flashes back onto the screen momentarily. While this is a poor solution to have to use, this OS is bugged and I am left with no choice.

    My activity now looks as though it is perfectly stable and working perfectly. I don't like it, but it works.

    Thanks a lot, google.

提交回复
热议问题