leandroBorgesFerreira / LoadingButtonAndroid

A button to substitute the ProgressDialog
MIT License
1.94k stars 214 forks source link

Button disappears after animation when width is set to wrap_content #177

Open makni-sahar opened 3 years ago

makni-sahar commented 3 years ago

Hello,

I have a problem after revert animation when width is wrap_content.

So, my code looks like this

<br.com.simplepass.loadingbutton.customViews.CircularProgressButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentEnd="true" android:layout_marginTop="160dp" android:layout_marginEnd="20dp" android:minWidth="0dp" android:minHeight="0dp" android:padding="10dp" .... app:spinning_bar_color="#FFF" app:spinning_bar_padding="6dp" app:spinning_bar_width="4dp" />

I've added minWidth and minHeight to remove extra padding on button and then set my own padding.

after the animation end, I set a new text like this :

loadingButton?.revertAnimation { // set text here }

The problem is the width is not set to wrap_content after animation end. (I see only the padding, if i remove the padding, the button disappears after animation)

If I change the width to an exact value (100dp for exemple) everything works fine.

Any fix for this problem?