From 32c1fc76d8b069e90d5e771b47acfd8a645c38f4 Mon Sep 17 00:00:00 2001 From: Tsung-Mao Fang Date: Tue, 1 Mar 2022 17:11:10 +0800 Subject: [PATCH] Fix unable to scroll to the bottom page We should set padding for root view instead of margin. Test: Verify the behavior is correct in single pane and two panes mode. Fix: 221422906 Change-Id: I17a63be6e536ffcf39744b2e98dc1ea2723ebf1d --- .../settings/homepage/SettingsHomepageActivity.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/com/android/settings/homepage/SettingsHomepageActivity.java b/src/com/android/settings/homepage/SettingsHomepageActivity.java index 051a54ad9cc..73c473a27ff 100644 --- a/src/com/android/settings/homepage/SettingsHomepageActivity.java +++ b/src/com/android/settings/homepage/SettingsHomepageActivity.java @@ -32,7 +32,6 @@ import android.util.ArraySet; import android.util.FeatureFlagUtils; import android.util.Log; import android.view.View; -import android.view.ViewGroup; import android.view.Window; import android.view.WindowManager; import android.widget.FrameLayout; @@ -236,12 +235,8 @@ public class SettingsHomepageActivity extends FragmentActivity implements ViewCompat.setOnApplyWindowInsetsListener(findViewById(android.R.id.content), (v, windowInsets) -> { Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()); - // Apply the insets as a margin to the view. Here the system is setting - // only the top dimensions. - ViewGroup.MarginLayoutParams mlp = - (ViewGroup.MarginLayoutParams) v.getLayoutParams(); - mlp.topMargin = insets.top; - v.setLayoutParams(mlp); + // Apply the insets paddings to the view. + v.setPadding(insets.left, insets.top, insets.right, insets.bottom); // Return CONSUMED if you don't want the window insets to keep being // passed down to descendant views.