code: public void setVisibility(int visibility) {
          if (this.visibility != visibility) {
              final boolean hasSpace = this.visibility == View.VISIBLE || this.visibility == View.INVISIBLE;
              final boolean removingSpace = visibility == View.GONE;
              final boolean change = hasSpace && removingSpace;
              this.visibility = visibility;
              // Only change the dataset if it is absolutely necessary
              if (change && mAdapterDataSetObserver != null) {
                  mAdapterDataSetObserver.onChanged();
              } else {
                  invalidate();
              }
          }
      }
docs: Set the enabled state of this view.
  
  @param visibility One of {@link View#VISIBLE}, {@link View#INVISIBLE}, or {@link View#GONE}.