Android Floating Action Button Semi Transparent Background Color(Android浮动动作按钮半透明背景色)
问题描述
我想使用带有半透明背景色的FAB。 但我得到的是两种不同颜色的FAB。有什么问题?
<android.support.design.widget.FloatingActionButton
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|left"
android:fadingEdgeLength="5dp"
app:borderWidth="0dp"
app:elevation="4dp"
app:backgroundTint="#99f03456"
app:fabSize="normal"/>
并且没有任何可抽屉。
推荐答案
在此遇到相同问题。 我尝试使用BackackTint在XML中设置Alpha透明度,但不起作用,并产生与屏幕截图相同的外观(两个圆圈)。
所以我用如下代码设置它:
floatingButton = (FloatingActionButton) findViewById(R.id.fab);
floatingButton.setAlpha(0.25f);
并且外观现在保持一致。
这篇关于Android浮动动作按钮半透明背景色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!