android - 我无法隐藏浮动操作按钮?
问题描述
我试图通过单击按钮隐藏我的 FAB,但它不起作用。?
我的 XML
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabbb"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_margin="@dimen/_10sdp"
android:src="@drawable/ic_arrow_forward_black_24dp"
android:tint="@color/md_white_1000" />
<Button
android:id="@+id/show"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/_10sdp"
android:text="HIDE" />
我的活动
show.setOnClickListener {
fabbb.visibility == View.GONE
}
解决方案
使用方法hide
:
fab.hide();
推荐阅读
- jenkins - 在詹金斯字符后返回字符串
- pine-script - array.median() 函数返回错误结果
- postgresql - 将 PostgreSQL 查询转换为 GORM 查询
- flutter - '未来的实例
'颤动 - python-asyncio - 如何从阻塞函数中获取结果?
- python - 新 Django 版本中的 Django CharField 唯一参数
- excel - 我无法在 excel 列 (AA) 中按当前日期进行过滤
- spring-boot - 启动 spring-boot 应用程序时无法加载默认配置文件
- pyspark - 仅更新更改的行 pyspark delta table databricks
- hive - 如何将配置单元查询结果导出到单个本地文件?