android+字体稍微加粗,的Android设置的Roboto字体,加粗,斜体,普通,...(有点像自定义字体家族)...

我知道豪设置自定义字体编程Android应用程序内。 有没有什么方法来加载自定义字体(资产)的字体和Android框架将使用基于大胆,斜体等适当的文件?的Android设置的Roboto字体,加粗,斜体,普通,...(有点像自定义字体家族)

比如现在我想的Roboto字体设置为某个TextView

Typeface typeface = Typeface.createFromAsset(getAssets(), "fonts/Roboto/Roboto-Regular.ttf");

textView.setTypeface(typeface);

它工作正常。但因为我设置TextView中的XML布局大胆,文本不加粗

android:id="@+id/my_id"

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:layout_marginLeft="20dp"

android:layout_marginRight="20dp"

android:layout_marginTop="50dp"

android:textStyle="bold"

android:gravity="center"

android:text="@string/my_text"

android:textColor="@color/my_foreground"

android:textSize="24dp" />

如何从资产加载字体正确,这将工作?

textView.setTypeface(typeface, Typeface.BOLD);

在我的资产目录中只有一个“字体系列”

Roboto-Black.ttf

Roboto-BlackItalic.ttf

Roboto-Bold.ttf

Roboto-BoldCondensed.ttf

Roboto-BoldCondensedItalic.ttf

Roboto-BoldItalic.ttf

Roboto-Condensed.ttf

Roboto-CondensedItalic.ttf

Roboto-Italic.ttf

Roboto-Light.ttf

Roboto-LightItalic.ttf

Roboto-Medium.ttf

Roboto-MediumItalic.ttf

Roboto-Regular.ttf

Roboto-Thin.ttf

Roboto-ThinItalic.ttf

如何加载所有排字体/家庭里面的字体?

2012-03-02

zmeda

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值