views:

582

answers:

2

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?

+1  A: 

This will return the value in pixels within a context:

float size = new TextView(this).getTextSize();
moraes
That's what I did, but I wonder if there is any other way without creating a new TextView?
yuku
A: 
TextView txt = (TextView) findById(R.id.text);
float size = txt.getTextSize();

This should do it on an existing one

avvie