为什么MaterialButton文本不包含完整空格?

问题描述 投票:1回答:1

参见:

enter image description here

代码:

<RelativeLayout
            android:id="@+id/circle_card_payment"
            android:layout_width="40dp"
            android:layout_height="40dp">

            <com.google.android.material.button.MaterialButton
                android:id="@+id/logo"
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:backgroundTint="@color/colorBlack"
                android:insetLeft="0dp"
                android:insetTop="0dp"
                android:insetRight="0dp"
                android:insetBottom="0dp"
                android:text="W"
                android:textColor="#FFFFFF"
                android:textSize="16sp"
                app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay_ButtonCircle50"
                app:strokeWidth="0dp" />

        </RelativeLayout>

style.xml

 <style name="ShapeAppearanceOverlay_ButtonCircle50">
        <item name="cornerFamily">rounded</item>
        <item name="cornerSize">20dp</item>
    </style>

为了确认材料按钮是否已包含全部空间,我将材料按钮的颜色改为黑色。并且内部文本颜色为白色。

有人可以根据我的情况给我确切的解决方案吗?请注意,您不应将相对布局尺寸从40 dp增加到50 dp,我知道可以解决此问题,但是徽标尺寸会更大,这是不合适的。

请注意,我必须将此按钮包装在任何根目录布局中。那是强制性的。就像现在一样,我的材质按钮位于相对布局内。

android material-design
1个回答
0
投票
为什么MaterialButton文本不包含完整空格?
© www.soinside.com 2019 - 2024. All rights reserved.