Scalified / fab

Floating Action Button Library for Android
Apache License 2.0
848 stars 164 forks source link

cant set color of button #40

Closed PappBalazs closed 8 years ago

PappBalazs commented 8 years ago

using it from code: fab.setButtonColor(R.color.myRed); or using it form xml: fab:button_color="@color/myRed" has no effect at all.

Also i could set image into fab only from code xml attribute didnt work

vbaidak commented 8 years ago

Hi PappBalazs!

Thank you for using ActionButton libarary

The listed features are basic ones and work correctly (you may see how they work watching the demo video). During the last year these features were tested by many users and no issues were found. This is true as for XML, so for dynamic code

Please do the following:

  1. Check you are doing things right
  2. If so, please send me the XML layout file (if any) and the code, where ActionButton is instantiated, configured and used
PappBalazs commented 8 years ago

Thank you for fast respond.

Xml: http://pastebin.com/8PCBBQWe Java: http://pastebin.com/FSGAnfUr

vbaidak commented 8 years ago
  1. From the documentation:
// To set button color for normal state:
actionButton.setButtonColor(getResources().getColor(R.color.fab_material_lime_500));

That is, you passes a resource id, but setButtonColor expects a resolved color int value

  1. In your layout correct the fab namespace. It must point to: "http://schemas.android.com/apk/res-auto"
  2. Retest the listed features after applying the corrective actions
PappBalazs commented 8 years ago

Thank you my friend, it is working now.

Hope i can help you too: update getResources.getColor in your documentation, beacause it is deprecated now, use fab.setButtonColor(ContextCompat.getColor(context, R.color.myBlue));

vbaidak commented 8 years ago

Great!

Sure, I shall perform refactoring and fix this in the last major release

Thank you and have a nice day