Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app:tl_textBold="SELECT"的情况下,默认选中的第一项未加粗 #544

Open
yongchao1210 opened this issue Jan 24, 2022 · 4 comments

Comments

@yongchao1210
Copy link

yongchao1210 commented Jan 24, 2022

**app:tl_textBold="SELECT"**的情况下,默认选中的第一项未加粗,这个问题是没麻烦作者修复一下。
<com.flyco.tablayout.SlidingTabLayout
android:id="@+id/stl_tab"
android:layout_width="match_parent"
android:layout_height="40dp"
app:tl_divider_color="@color/transparent"
app:tl_divider_padding="13dp"
app:tl_divider_width="1dp"
app:tl_indicator_color="@color/common_primary_color"
app:tl_indicator_height="2dp"
app:tl_indicator_width_equal_title="true"
app:tl_tab_padding="15dp"
app:tl_tab_space_equal="true"
app:tl_textBold="SELECT"
app:tl_textSelectColor="@color/common_text_title_color"
app:tl_textUnselectColor="@color/common_text_explain_color"
app:tl_textsize="15sp"
app:tl_underline_color="@color/transparent"
app:tl_underline_height="0dp" />

@liyuhaolol
Copy link

自己改吧,老BUG了,好多年了

@lovemelon2017
Copy link

怎么改这个

@xiongsongyu2016
Copy link

updateTabStyles()这个方法处 要将TEXT_BOLD_WHEN_SELECT 这里添加上
if (mTextBold == TEXT_BOLD_BOTH) {
tv_tab_title.getPaint().setFakeBoldText(true);
} else if (mTextBold == TEXT_BOLD_WHEN_SELECT) {
if (i == 0) {
tv_tab_title.getPaint().setFakeBoldText(true);
}
} else if (mTextBold == TEXT_BOLD_NONE) {
tv_tab_title.getPaint().setFakeBoldText(false);
}

@FrankLove
Copy link

还有一个临时解决办法就是先设置一个其他的,再设置第一个,这样也可以
mSlideTabLayout.setCurrentTab(1);
mSlideTabLayout.setCurrentTab(0);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants