We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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中实现显示自定义的字体那?
<TextView android:textColor="@color/white" android:text="思源——Regular!" android:fontFamily="@font/sy_regular" android:textSize="40sp" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:layout_marginTop="80dp" android:textColor="@color/white" android:text="思源——Medium!" android:fontFamily="@font/sy_medium" android:textSize="40sp" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <TextView android:layout_marginTop="160dp" android:textColor="@color/white" android:text="思源——Heavy!" android:fontFamily="@font/sy_heavy" android:textSize="40sp" android:layout_width="wrap_content" android:layout_height="wrap_content"/>
上面的用法常用的够了,不过相对正规一点还是要创建字体系列 定义一个xml来引用不同的font,算是一个字体筛选器,可以通过设置不同属性,精确匹配。这里先不展开了
创建字体系列
也可以用代码方式,当然肯定是xml定义用起来更方便
Typeface typeface = getResources().getFont(R.font.myfont); textView.setTypeface(typeface);
The text was updated successfully, but these errors were encountered:
No branches or pull requests
前言
现在的字体已经很丰富了,问题安卓系统预装的字体并不完善,特别对于中文的一些字体是默认没有的。那我们要怎么在app中实现显示自定义的字体那?
应用
创建字体系列
上面的用法常用的够了,不过相对正规一点还是要创建字体系列
定义一个xml来引用不同的font,算是一个字体筛选器,可以通过设置不同属性,精确匹配。这里先不展开了
创建字体系列
以程序化方式使用字体
也可以用代码方式,当然肯定是xml定义用起来更方便
相关链接
The text was updated successfully, but these errors were encountered: