leandroBorgesFerreira / LoadingButtonAndroid

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

Button not coming in center when animating #62

Closed shubham08gupta closed 6 years ago

shubham08gupta commented 6 years ago

Hi, I tried to use this library. The button is on the left but not coming to center when the animation starts. I've used the Second Activity layout and copied a button from MainActivity.kt to SecondActivity.kt

ezgif com-video-to-gif

shubham08gupta commented 6 years ago

So I've tried to solve it and found that the attribute android:gravity="center_horizontal" solves it. This happens when the layout is LinearLayout. What if the layout is ConstraintLayout?

leandroBorgesFerreira commented 6 years ago

This is nothing more than a library that animated into a loading spinner. It will respect its parent gravity. Since it is not possible to set gravity to ConstraintLayout you can wrap the button inside a LinearLayout and use it in the Constraint Layout

Harin-Kaklotar commented 6 years ago

@leandroBorgesFerreira @shubham171294 it works with ContraintLayout also (without LinearLayout). We have to just set app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" constrain property in the button and it work good.