From 93c14d43b068240e722df3c681bfc38221b63e59 Mon Sep 17 00:00:00 2001 From: khanhduytran0 Date: Tue, 15 Dec 2020 12:48:16 +0700 Subject: [PATCH] [VerticalTabLayout] Try to fix gravity, size, etc.. --- .../android/support/design/widget/VerticalTabLayout.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/android/support/design/widget/VerticalTabLayout.java b/app/src/main/java/android/support/design/widget/VerticalTabLayout.java index 2e33a8331..af267e69d 100644 --- a/app/src/main/java/android/support/design/widget/VerticalTabLayout.java +++ b/app/src/main/java/android/support/design/widget/VerticalTabLayout.java @@ -1743,12 +1743,18 @@ public class VerticalTabLayout extends LinearLayout { if (mIconView == null) { ImageView iconView = (ImageView) LayoutInflater.from(getContext()) .inflate(R.layout.design_layout_tab_icon, this, false); + iconView.serLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, + ViewGroup.LayoutParams.MATCH_PARENT)); addView(iconView, 0); mIconView = iconView; } if (mTextView == null) { TextView textView = (TextView) LayoutInflater.from(getContext()) .inflate(R.layout.design_layout_tab_text, this, false); + LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT); + textParams.gravity = Gravity.TOP | Gravity.CENTER_VERTICAL; + textView.setLayoutParams(textParams); addView(textView); mTextView = textView; mDefaultMaxLines = TextViewCompat.getMaxLines(mTextView); @@ -2016,9 +2022,6 @@ public class VerticalTabLayout extends LinearLayout { mIndicatorAnimator.cancel(); } - final boolean isRtl = ViewCompat.getLayoutDirection(this) - == ViewCompat.LAYOUT_DIRECTION_RTL; - final View targetView = getChildAt(position); if (targetView == null) { // If we don't have a view, just update the position now and return