ExtendedFloatingActionButton-图标重力设置为文本结尾,但在尖叫时图标未居中

时间:2019-12-10 11:59:48

标签: android floating-action-button material-components material-components-android

我正在使用com.google.android.material:material:1.2.0-alpha02

添加图标并将其重力设置为文本时,其不居中。 icon is a vector imported from resource manager

此外,当FAB展开时,图标右侧还会有额外的填充 yellow line shows the extra padding

XML代码

<androidx.constraintlayout.widget.ConstraintLayout
    android:id="@+id/bottom_layout"
    android:layout_width="match_parent"
    android:layout_height="@dimen/dim_65dp"
    android:background="#FF0000"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent">

    <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
        android:id="@+id/extended_floating_action_button"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/dim_8dp"
        android:layout_marginBottom="@dimen/dim_8dp"
        android:contentDescription="@string/next"
        android:text="@string/get_started"
        android:textAlignment="center"
        app:icon="@drawable/ic_navigate_next_white_24dp"
        app:iconTint="#000000"
        app:iconGravity="textEnd"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

在未设置重力的情况下,但箭头图标显示在FAB的左侧,文本显示在右侧的情况下,它可以正常工作。No extra padding too

0 个答案:

没有答案