0

I have a FAB class extending FrameLayout where I want to have a hide method which implements the reveal effect. Therefore I need to set the visibility to INVISIBLE:

public class FloatingActionButton extends FrameLayout implements Checkable {
    ...
    private void hide() {
        ...
            this.setVisibility(View.INVISIBLE);
        ...
        hideFabAnimator.start();
    }
}

But I get an error when trying to call setVisibility() on 'this' : "Cannot resolve method 'setVisibilty(int)'".

Sergey Glotov
  • 20,200
  • 11
  • 84
  • 98
SnafuBernd
  • 261
  • 4
  • 16

1 Answers1

2

Seems that this.setVisibility(View.INVISIBLE); is located inside another class. It this case FloatingActionButton.this.setVisibility(View.INVISIBLE) will solve your issue.

You can find explanation here.

Community
  • 1
  • 1
Sergey Glotov
  • 20,200
  • 11
  • 84
  • 98