开发者

Getting the default font size of a multiline TextView in Android

开发者 https://www.devze.com 2022-12-18 06:28 出处:网络
I want to have a font-size preference in percentage relative to the default font-size, 开发者_高级运维so I need to get the default font-size for a TextView.

I want to have a font-size preference in percentage relative to the default font-size, 开发者_高级运维so I need to get the default font-size for a TextView.

How do I get the default font-size of a TextView?


This will return the value in pixels within a context:

float size = new TextView(this).getTextSize();


TextView txt = (TextView) findById(R.id.text);
float size = txt.getTextSize();

This should do it on an existing one

0

精彩评论

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

关注公众号