Skip to content

空心字设置了无效果 #120

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

Open
XuMengren opened this issue Aug 23, 2024 · 2 comments
Open

空心字设置了无效果 #120

XuMengren opened this issue Aug 23, 2024 · 2 comments

Comments

@XuMengren
Copy link

implementation 'com.github.chenBingX:SuperTextView:v3.2.6.99'

<com.coorchice.library.SuperTextView
android:id="@+id/tv_sort"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="2dp"
android:ellipsize="end"
android:maxLines="1"
android:singleLine="true"
android:textSize="12sp"
android:gravity="center"
android:textStyle="bold"
android:layout_gravity="center"
app:stv_text_stroke="true"
app:stv_text_fill_color="#FFF8CB"
app:stv_text_stroke_color="#222222"
app:stv_text_stroke_width="1dp"
android:text="添加新分类" />

image

我没有设置字体颜色,为什么他会是白色的

@XuMengren
Copy link
Author

image
在项目中预览又是正常的

@vince-cooper
Copy link

vince-cooper commented Mar 28, 2025

targetSdk设置为29及以上,会导致下面的代码发生异常,导致失效

private void setTextColorNoInvalidate(int color) {
Field textColorField;
try {
textColorField = TextView.class.getDeclaredField("mCurTextColor");
textColorField.setAccessible(true);
textColorField.set(this, color);
textColorField.setAccessible(false);
} catch (Exception e) {
e.printStackTrace();
}
}

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

2 participants