Android浮动操作按钮中仅显示图标

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

我只想在FloatingActionButton中显示我的可绘制图标(至少14 API或更高级别)。我尝试了src,背景,更改的背景色,borderWidth,各种各样的东西,但没有任何帮助。即使更改我的可绘制对象的大小也不会更改其显示大小。它很小,周围有按钮背景。我希望它更大并且没有背景。

PS。不想使用ImageView这样做并失去FloatingActionButton提供的所有功能。

 <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="20dp"
        android:layout_marginRight="20dp"
        android:layout_marginBottom="20dp"
        android:src="@drawable/ic_add_circle"
        app:borderWidth="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintRight_toRightOf="parent" />
android floating-action-button
1个回答
0
投票

尝试一下:

<com.google.android.material.floatingactionbutton.FloatingActionButton
    android:id="@+id/faBtn"

    android:layout_width="wrap_content"
    android:layout_height="wrap_content"

    android:layout_marginEnd="20dp"
    android:layout_marginRight="20dp"
    android:layout_marginBottom="20dp"

    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintRight_toRightOf="parent"


    android:src="@drawable/ic_add_circle"

    app:fabCustomSize="@dimen/fabSize"
    app:fabSize="normal"
    app:maxImageSize="@dimen/fabImageSize"

    android:background="@null"
    android:backgroundTint="@null"

    app:backgroundTint="@null"
    app:elevation="0dp"
    android:elevation="0dp"
/>

要使晶圆厂不投射阴影,您需要将标高设置为0;没有找到其他方法。

祝你有美好的一天。

© www.soinside.com 2019 - 2024. All rights reserved.