slidetoact icon indicating copy to clipboard operation
slidetoact copied to clipboard

How to add drawable to button

Open blabz-rahulmandalkar opened this issue 6 years ago • 11 comments

I want set drawable background instead of color to button ( app:inner_color="@color/colorPrimary")

blabz-rahulmandalkar avatar Aug 01 '18 07:08 blabz-rahulmandalkar

Hey @blabz-rahulmandalkar Do you have some mocks or some screenshots of what you want to implement?

The real problem with what you're asking is that the background get resized during the animation. I'm not so sure of what you would love to do with a drawable: crop it? resize it?

Furthermore the inner_color would still be needed since it has several effects. From the README.md file:

Use the inner_color attribute to control the color of the inner circular button, the color of the tick icon and the color of the text. If not set, this attribute defaults to colorBackground from your theme.

cortinico avatar Aug 01 '18 11:08 cortinico

I want to apply gradient color to inner circular button from drawable resource like below screen shot 2018-08-03 at 10 21 18 am

blabz-rahulmandalkar avatar Aug 03 '18 04:08 blabz-rahulmandalkar

Wrap SlideToActView in a FrameLayout and set your background drawable to your gradient colour. Add a margin of 1dp to SlideToActView, with outer_color as #FFFFFF

squeeish avatar Nov 12 '18 09:11 squeeish

Yeah that's a bit hacky but it should more or less work. I could eventually implement this feature if someone else is interested in this.

cortinico avatar Nov 12 '18 22:11 cortinico

I am interested too! You can allow to change the hole button icon? Not only the inside icon.

IreneTrullen avatar Nov 29 '18 12:11 IreneTrullen

@IreneTrullen I could allow to change the inside icon and maybe the gradient as well. Having a generic drawable for the bobble would be really hard to implement from the animation point of view. Do you have something in mind?

cortinico avatar Nov 29 '18 13:11 cortinico

So, maybe can you allow to change the width and height of the icon inside the booble?

IreneTrullen avatar Nov 29 '18 13:11 IreneTrullen

@cortinico How to set the background of the arrow icon to gradient as the @blabz-rahulmandalkar mentioned before?

jamesweb1 avatar Feb 25 '20 02:02 jamesweb1

@cortinico How to set the background of the arrow icon to gradient as the @blabz-rahulmandalkar mentioned before?

Currently is not possible. I'm happy to review a PR if you're willing to develop this feature 🙏

cortinico avatar Feb 25 '20 14:02 cortinico

Hi all, how about this?? Any update?? I need the innerColor could be drawble Screen Shot 2020-04-06 at 5 21 54 PM

samk17cmutpm avatar Apr 06 '20 10:04 samk17cmutpm

Thanks for your input @samk17cmutpm

I'm happy to review a PR if you're willing to develop this feature 🙏

This is still valid. I might have some time in the near future but I can't promise anything at this point.

cortinico avatar Apr 07 '20 00:04 cortinico