mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(tabview):improve tabview tab item title layout (#114)
This commit is contained in:
@@ -66,7 +66,7 @@ public class TabLayout extends HorizontalScrollView {
|
||||
private static final int TITLE_OFFSET_DIPS = 24;
|
||||
private static final int TAB_VIEW_PADDING_DIPS = 16;
|
||||
private static final int TAB_VIEW_TEXT_SIZE_SP = 12;
|
||||
private static final int TEXT_MAX_WIDHT = 180;
|
||||
private static final int TEXT_MAX_WIDTH = 180;
|
||||
private static final int SMALL_MIN_HEIGHT = 48;
|
||||
private static final int LARGE_MIN_HEIGHT = 72;
|
||||
|
||||
@@ -240,7 +240,7 @@ public class TabLayout extends HorizontalScrollView {
|
||||
|
||||
TextView textView = new TextView(context);
|
||||
textView.setGravity(Gravity.CENTER);
|
||||
textView.setMaxWidth((int) (TEXT_MAX_WIDHT * density));
|
||||
textView.setMaxWidth((int) (TEXT_MAX_WIDTH * density));
|
||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_SP, TAB_VIEW_TEXT_SIZE_SP);
|
||||
textView.setTypeface(Typeface.DEFAULT_BOLD);
|
||||
textView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
|
||||
@@ -21,9 +21,7 @@ import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.View;
|
||||
import android.widget.LinearLayout;
|
||||
@@ -86,6 +84,8 @@ class TabStrip extends LinearLayout {
|
||||
|
||||
// Default selected color is the same as mTabTextColor
|
||||
mSelectedTabTextColor = mTabTextColor;
|
||||
|
||||
setMeasureWithLargestChildEnabled(true);
|
||||
}
|
||||
|
||||
void setCustomTabColorizer(TabLayout.TabColorizer customTabColorizer) {
|
||||
|
||||
Reference in New Issue
Block a user