tags:

views:

32

answers:

1

I'm using a FrameLayout and have two buttons on it, button A and button B (in addition to some 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.

A: 

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.

Mayra
Even when sent to GONE, button B still doesn't respond to touch events...I'll keep trying =)
just_another_coder
Maybe I should just create/remove buttons on the fly?
just_another_coder
Why do you want to do that? Just change the text and onClick method of the button based on which behavior you want.
Mayra