开发者

TextView textsize method

there are 2 methods to set the textsize of a textview. The one I am interested in setTextSize (int unit,开发者_Go百科 float size). I am unable to find the int list for all the units (dp, sp,..). Anybody knows what are the int values of those units in Android? tHANKS


Via the API...

sp: TypedValue.COMPLEX_UNIT_SP

dip: TypedValue.COMPLEX_UNIT_DIP

Take a look at the constants of the TypedValue class for all the possible units.

http://developer.android.com/reference/android/util/TypedValue.html http://developer.android.com/reference/android/widget/TextView.html#setTextSize(int, float)

You can also convert to pixels dynamically: http://developer.android.com/guide/practices/screens_support.html#dips-pels

Hope that helps!

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜