I'm using a FrameLayout and have two buttons on it, button A and button B (in addition to so开发者_JS百科me other widgets). A is directly on top of B, overlapping completely.
In onCreate, I do a check and if A is not needed, I set it to invisible. Later in the app it may become visible again so I don't want to remove it completely.
When button B is pressed, it doesn't respond. I think button A is stopping the press even though it's invisible. Other buttons do respond so this is why I think this.
Is there a common way to make it so B accepts touches? Do I have to remove A? I don't really want to remove A as I have a relative layout in the frame layout and other controls depend on A for positioning.
Personally I think it would make a lot more sense to have a single button who's properties vary based on configuration. However, if you really want to have two, you could try a couple of things:
Set the invisible button to not be focusable or touchable. Set the button to Gone, not invisible. This might mess up the layout though, since this basically says not to consider the button when doing the layout.
精彩评论