zendesk / android-floating-action-button

Floating Action Button for Android based on Material Design specification
Apache License 2.0
6.38k stars 1.46k forks source link

Custom background drawable #58

Open bobans opened 9 years ago

bobans commented 9 years ago

Can you add the option to set background drawable? It can be useful when you need to disable the button, with current state it just has 'colorNormal'.

chalup commented 9 years ago

Hmm, it might actually make more sense to deprecate the colorNormal/colorPressed attributes in favour of backgroundColor attribute which accepts the color state list. Your comments/thoughts on this approach?

bobans commented 9 years ago

It sounds good. If it is not big requirement it would be nice to have possibility to set also drawable as background.

DineshAnandan commented 9 years ago

:+1: for backgroundColor attribute. because i can use the ripple effect in L :)

chalup commented 9 years ago

@bobans I still haven't implement custom background support, but the fab_colorDisabled was added in #100, available since version 1.6.0.

dmitry-zaitsev commented 9 years ago

@DineshAnandan can you actually use ripple as color state list? I doubt it.

I would rather deprecate all custom attributes (colorNormal, colorPressed, colorDisabled) and use android:background instead which we can then paint as a circle using BitmapShader. That would allow any kinds of background drawables. Hopefully I'll find the time to make pull request for it :) If not - you have my idea.