浮动操作按钮图标不在内部居中 [英] Floating Action Button Icon not centered inside

查看:81
本文介绍了浮动操作按钮图标不在内部居中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用FAB,但是其中的图标位于按钮的右下角:

I'm trying to use a FAB but the icon inside is placing at bottom right of the button:

FAB的图标未居中

这是xml中的FAB定义:

This is the FAB definition in the xml:

<RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <com.google.android.material.floatingactionbutton.FloatingActionButton
            android:id="@+id/centerLocationButton"
            style="@style/Widget.MaterialComponents.FloatingActionButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentEnd="true"
            android:layout_alignParentRight="true"
            android:layout_margin="@dimen/pro_arriving_map_location_button_padding"
            android:src="@drawable/ic_my_location"
            app:backgroundTint="@color/white"
            app:fabSize="mini" />

    </RelativeLayout>

我在做什么错了?

推荐答案

我的解决方案是app:fabCustomSize="56dp"

这篇关于浮动操作按钮图标不在内部居中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆