我想以编程方式显示/隐藏Google Material Floating Action按钮。我正在使用Google材料库
implementation 'com.google.android.material:material:1.1.0'
并使用以下代码
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_settings);
FloatingActionButton fab = findViewById(R.is.fab);
fab.hide() // This is the method to hide the button as the Documentation But This does not hide the button
fab.setVisibility(View.GONE) // Neither this work,
}
还有其他隐藏方法吗?