Android浮动动作按钮半透明背景色 [英] Android Floating Action Button Semi Transparent Background Color

查看:30
本文介绍了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浮动动作按钮半透明背景色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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