`

EditText的字体和大小

阅读更多
<style name="TextAppearance.Medium">
        <item name="android:textSize">18sp</item>
        <item name="android:textStyle">normal</item>
        <item name="android:textColor">?textColorPrimary</item>
</style>
其中textSize是设置字体大小

字体也可以指定,如果指定字体风格的话
<item name="android:textStyle">normal</item>

如果是指定字体,也就是说字体样式,如:宋体,黑体,那么你需要自己添加字体文件了,因为系统里面有可能不支持你设置的字体,以TextView为例
Typeface type = Typeface.createFromAsset(getContext().getAssets(),                            "fonts/samplefont.ttf");
TextView text = new TextView(getContext());
text.setTypeface(type);
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics