[Fix] RyC Scrolling Bug
@@ -14,6 +14,7 @@ import android.support.v7.widget.Toolbar;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
+
import com.mercadopago.MercadoPagoBaseActivity;
import com.mercadopago.R;
import com.mercadopago.components.Action;
@@ -112,21 +113,19 @@ public final class ReviewAndConfirmActivity extends MercadoPagoBaseActivity impl
}
private void configureFloatingBehaviour(final NestedScrollView scrollView, final View floatingConfirmLayout) {
- addScrollBottomMargin(floatingConfirmLayout, scrollView);
+ addScrollBottomPadding(floatingConfirmLayout, scrollView);
configureScrollLayoutListener(floatingConfirmLayout, scrollView);
addScrollListener(floatingConfirmLayout, scrollView);
}
- private void addScrollBottomMargin(final View floatingConfirmLayout, final NestedScrollView scrollView) {
+ private void addScrollBottomPadding(final View floatingConfirmLayout, final NestedScrollView scrollView) {
ViewTreeObserver floatingObserver = floatingConfirmLayout.getViewTreeObserver();
floatingObserver.addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
@Override
public void onGlobalLayout() {
- CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) scrollView.getLayoutParams();
- int bottomMargin = floatingConfirmLayout.getHeight();
- if (bottomMargin != params.bottomMargin) {
- params.setMargins(params.leftMargin, params.topMargin, params.rightMargin, bottomMargin);
- scrollView.setLayoutParams(params);
+ int bottomPadding = floatingConfirmLayout.getHeight();
+ if (scrollView.getPaddingBottom() != bottomPadding) {
+ scrollView.setPadding(scrollView.getPaddingLeft(), scrollView.getPaddingTop(), scrollView.getPaddingRight(), bottomPadding);
}
}
});
