让textFontWeight
属性支持Api29(Android9-p)以下。
模拟器 Android5.1 | OnePlus6 Android10 | RedmiK50 Android14 |
---|---|---|
![]() |
![]() |
![]() |
maven { url 'https://jitpack.io' }
//compileSdk=34(appcompat:1.7.0) - 导入依赖
implementation("com.github.simplepeng:FontWeightTextView:1.0.0")
// 或 compileSdk=34(appcompat:1.6.1) - 导入依赖
implementation("com.github.simplepeng:FontWeightTextView:compat_161")
<me.simple.fwtv.FontWeightTextView
style="@style/WeightTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="自定义400"
app:textFontWeight="400" />
textFontWeight
属性支持1-1000
的数值。
<me.simple.fwtv.FontWeightValueTextView
style="@style/WeightTextStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Medium"
app:fontWeightValue="medium" />
fontWeightValue
支持以下属性:
<declare-styleable name="FontWeightValueTextView">
<attr name="fontWeightValue" format="enum">
<enum name="thin" value="100" />"
<enum name="extraLight" value="200" />"
<enum name="light" value="300" />"
<enum name="normal" value="400" />"
<enum name="medium" value="500" />"
<enum name="semiBold" value="600" />"
<enum name="bold" value="700" />"
<enum name="extraBold" value="800" />"
<enum name="black" value="900" />"
</attr>
</declare-styleable>
- v1.0.0 - 首次发布