VisibilityAwareImageButton.setVisibility can only be called from within the same

286 阅读1分钟

对于FloatingActionButton的设置隐藏和显示使用

floatingActionButton.setVisibility(View.VISIBLE)
floatingActionButton.setVisibility(View.GONE)

会出现这种错误

VisibilityAwareImageButton.setVisibility can only be called from within the same

,因而需要使用则不能使用上述的方法,需使用这种:

floatingActionButton.show()
floatingActionButton.hide()