Android - Button visibility not changing

96 views Asked by At

this is probably a dummy question but I've searching for at least an hour and I didn't find any solution.

I'm working with Google Maps and I'm setting a button visibility to VISIBLE when the user clicks on an info window. This is working great, even when a little animation.

But when the users presses anywhere else on the map, the info window close listener is executed and the button must be set to GONE like this:

@Override
public void onInfoWindowClose(Marker marker) {
    Log.e("INFOCLOSED", "isVisible: " + (apply.getVisibility() == View.VISIBLE));
    apply.setVisibility(View.GONE);
    apply.invalidate();
    Log.e("INFOCLOSED", "isVisible: " + (apply.getVisibility() == View.VISIBLE));
}

My output is this:

12-13 23:37:09.027 7209-7209/... E/INFOCLOSED: isVisible: true
12-13 23:37:09.027 7209-7209/... E/INFOCLOSED: isVisible: false

But my button still visible, what I'm doing wrong?

1

There are 1 answers

0
Roman Dev On BEST ANSWER

I don't know why but I solved this problem by adding a fading animation which has "forced" the view to be gone as it seems that the view is officially gone but we still can see it.