【发布时间】:2020-05-28 21:00:57
【问题描述】:
我试图通过单击按钮来隐藏我的 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
}
【问题讨论】:
-
使用
fabbb.visibility = View.GONE
标签: android android-studio android-layout floating-action-button material-components-android