【发布时间】:2016-06-28 05:04:21
【问题描述】:
我在布局 xml 中的 fab 上添加了 layout_anchor 属性。单击按钮后,fab 应位于屏幕末尾。为了实现这一点,我正在考虑添加重力属性。但是我如何以编程方式删除 layout_anchor 属性。
layout.xml
<com.samsoft.sam.Fab
android:id="@+id/fab"
app:layout_anchor="@id/asd"
app:layout_anchorGravity="top|end"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
上面是我的 fab 代码,它的位置很完美,现在我需要用 android:gravity="top|end" 以编程方式替换布局锚属性。请帮帮我。
【问题讨论】:
-
您在 Java 代码中执行此操作。我们能看到吗?
标签: android floating-action-button