空心字设置了无效果
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="添加新分类" />
我没有设置字体颜色,为什么他会是白色的
在项目中预览又是正常的
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(); } }