我有使用[strong>快速拨号库的浮动操作按钮。在此,我想通过编程方式更改 fabGravity 。我该如何实现?
<io.github.yavski.fabspeeddial.FabSpeedDial
android:id="@+id/position_bottom_end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right"
app:fabGravity="bottom_start"
app:fabMenu="@menu/menu_main"
app:touchGuard="false" />
答案 0 :(得分:0)
尝试
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
FrameLayout.LayoutParams layoutparams = (FrameLayout.LayoutParams)
fab.getLayoutParams();
layoutparams.gravity = Gravity.BOTTOM | GravityCompat.START;
fab.setLayoutParams(layoutparams);