android - FloatingActionButton 设置背景色无效

查看:727
本文介绍了android - FloatingActionButton 设置背景色无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

设置FloatingActionButton的代码如下:

            <android.support.design.widget.FloatingActionButton
                android:id="@+id/enter_floating_button"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentBottom="true"
                android:layout_alignParentRight="true"
                android:layout_marginBottom="40dip"
                android:layout_marginRight="10dip"
                android:clickable="true"
                app:background="#00FF00"
                app:backgroundTint="#00FF00"
                app:rippleColor="@android:color/red"
                app:fabSize="normal"
                android:src="@drawable/ic_done" />

但是设置了app:backgroundapp:backgroundTint之后FloatingActionButton的显示颜色还是原来的颜色而不是指定的颜色。另外app:rippleColor设置后按下的颜色也没有变,这个是为什么?我需要怎么改变它的背景色和按下的颜色?最好不要用主题里的accentColor

解决方案

用Selector....

参考。。。
http://blog.csdn.net/lmj623565791/article/details/46678867

这篇关于android - FloatingActionButton 设置背景色无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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