pikanezi pikanezi - 3 years ago 96
Android Question

How to style the FloatingActionButton from the android.support.design

I'm trying to add a focus effect more noticeable to the FloatingActionButton of the android.support.design.

So far, I've tested to add a custom background to the button:

<android.support.design.widget.FloatingActionButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/ic_done_24dp"
android:background="@drawable/focus_gold"
app:backgroundTint="#F7A200"
app:pressedTranslationZ="12dp" />


With the drawable focus_gold being:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:drawable="#ff9800"/>
</selector>


Here is the result (the red background is normal):

unfocused: unfocused

focused: focused

Does anyone have an idea to set a nice and simple focus effect on a fab button with this library?

Thanks,

Vincent

Answer Source

you can try the unofficial FloatingActionButton library! Here is the github link: https://github.com/makovkastar/FloatingActionButton

Hope it helped!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download