From c04b86a7b20de5afe23e0f56fbc5e2e3ac8a32e1 Mon Sep 17 00:00:00 2001 From: zhengsr <845731923@qq.com> Date: Tue, 15 Feb 2022 14:36:16 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8DTabColorTextView=20?= =?UTF-8?q?=E5=8A=A0=E7=B2=97=E4=B8=8D=E8=B5=B7=E4=BD=9C=E7=94=A8=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TAB_README.md | 2 +- appx/src/main/res/layout/item_color_msg.xml | 3 ++- appx/src/main/res/layout/item_msg.xml | 2 +- .../java/com/zhengsr/tablib/view/TabColorTextView.java | 8 ++++++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/TAB_README.md b/TAB_README.md index cfc0771..88ed830 100644 --- a/TAB_README.md +++ b/TAB_README.md @@ -361,7 +361,7 @@ private void resFlow(){ |tab_action_orientaion|integer|left坐标,right右边,只支持 tri、rect 两种效果| |tab_isAutoScroll|boolean|是否支持自动滚动,默认为true| |tab_visual_count|integer|可视化个数,比如有一排,我们就只要显示4个,此时宽度均分| -|tab_width_equals_text|boolean|rect 是否根据text的大小来,目前只支持rect和带viewpager的情况| +|tab_width_equals_text|boolean|rect 是否根据text的大小来,目前只支持rect和带viewpager和不放大的情况| **TabColorTextView** diff --git a/appx/src/main/res/layout/item_color_msg.xml b/appx/src/main/res/layout/item_color_msg.xml index 9c95fa9..96ef8b5 100644 --- a/appx/src/main/res/layout/item_color_msg.xml +++ b/appx/src/main/res/layout/item_color_msg.xml @@ -17,10 +17,11 @@ android:paddingBottom="6dp" android:paddingStart="12dp" android:paddingEnd="12dp" - android:textSize="14sp" + android:textSize="18sp" app:colortext_default_color="@color/unselect" app:colortext_change_color="@color/colorAccent" android:gravity="center" + android:textStyle="bold" android:layout_height="wrap_content"/> diff --git a/tablibx/src/main/java/com/zhengsr/tablib/view/TabColorTextView.java b/tablibx/src/main/java/com/zhengsr/tablib/view/TabColorTextView.java index be4f31a..2d3628b 100644 --- a/tablibx/src/main/java/com/zhengsr/tablib/view/TabColorTextView.java +++ b/tablibx/src/main/java/com/zhengsr/tablib/view/TabColorTextView.java @@ -5,6 +5,7 @@ import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; +import android.graphics.Typeface; import android.util.AttributeSet; import android.util.Log; import android.view.Gravity; @@ -55,10 +56,13 @@ public TabColorTextView(Context context, AttributeSet attrs, int defStyleAttr) { mDefaultColor = ta.getColor(R.styleable.TabColorTextView_colortext_default_color, Color.GRAY); mChangeColor = ta.getColor(R.styleable.TabColorTextView_colortext_change_color,Color.WHITE); ta.recycle(); - mPaint = new Paint(); + /*Paint = new Paint(); mPaint.setAntiAlias(true); mPaint.setDither(true); - mPaint.setTextSize(getTextSize()); + mPaint.setTextSize(getTextSize());*/ + mPaint = getPaint(); + mPaint.setTypeface(Typeface.DEFAULT_BOLD); + Log.d(TAG, "zsr TabColorTextView: "+mPaint.getTypeface().isBold()); } @Override