Skip to content

Commit

Permalink
1.修复TabColorTextView 加粗不起作用的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
Zzhengsr committed Feb 15, 2022
1 parent 6128dec commit c04b86a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion TAB_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**
Expand Down
3 changes: 2 additions & 1 deletion appx/src/main/res/layout/item_color_msg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>

<TextView
Expand Down
2 changes: 1 addition & 1 deletion appx/src/main/res/layout/item_msg.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
android:paddingBottom="6dp"
android:paddingStart="12dp"
android:paddingEnd="12dp"
android:textSize="14sp"
android:textSize="18sp"
android:gravity="center"
android:textColor="@color/unselect"
android:layout_height="wrap_content"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit c04b86a

Please sign in to comment.