开发者

How make font in TextView more thinner?

I want to make fon开发者_StackOverflow社区t in TextView more thinner. How can I do it?


You can do this using a fontFamily:

From xml:

android:fontFamily="sans-serif-light"

Programmatically

textView.setTypeface(Typeface.create("sans-serif-light", Typeface.NORMAL));


in android only four fonttype-face

TypeFace

Typeface.DEFAULT
Typeface.MONOSPACE
Typeface.SANS_SERIF
Typeface.SERIF

and font-type

Typeface.NORMAL
Typeface.BOLD
Typeface.BOLD_ITALIC
Typeface.ITALIC

you can use like as

textView.setTypeface(Typeface.DEFAULT, Typeface.BOLD);

and other way is you can download any .ttf file and put it in asset folder and use like as this

Typeface type=Typeface.createFromAsset(context.getAssets(),
        "DroidSansMono.ttf");
textView.setTypeface(type, null);


Have you tried this attribute in your layout xml?

android:height="10dp" //Use as many pixel as you want here


you can use another typeface as well if you want:

android:typeface="monospace"

or increase the size of the text :

android:textSize="15sp"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜