【发布时间】:2017-12-22 02:22:17
【问题描述】:
我在我的应用程序中使用了几个 FloatingActionButton:
<android.support.design.widget.FloatingActionButton
android:id="@+id/loc_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginBottom="123dp"
android:layout_marginEnd="@dimen/mini_fab_margin"
android:src="@drawable/plus"
app:backgroundTint="@android:color/black"
app:elevation="2dp"
app:fabSize="mini"/>
其中 plus.png 是具有透明背景的小加号图像。
我知道 FloatingActionButton 默认选择您在 colors.xml 中设置的应用程序的 colorPrimary
我知道我们可以通过标签改变颜色:
app:backgroundTint="@android:color/black"
但是我们可以去除颜色吗?我的意思是我们可以在 FloatingActionButton 中有一个带有背景颜色的图像吗,
我尝试过使用
app:backgroundTint="@android:color/transparent"
但它仍然在图像周围显示黑色阴影。我们如何才能删除它并只显示没有任何背景的图像。 ?
这就是 app:backgroundTint="@android:color/transparent" 和 style : style="?android:attr/borderlessButtonStyle" 的样子:
寻找周围的透明圆圈,因为有阴影。正是在这里,我无法摆脱阴影,但我希望图像周围有阴影。
【问题讨论】:
标签: android floating-action-button