[VerticalTabLayout] Try to fix gravity, size, etc..

This commit is contained in:
khanhduytran0 2020-12-15 12:48:16 +07:00
parent c3953e4a35
commit 93c14d43b0

View File

@ -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