Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想要相对于默认字体大小的百分比字体大小首选项,因此我需要获取 TextView 的默认字体大小。
如何获取 TextView 的默认字体大小?
这将在上下文中返回以像素为单位的值:
float size = new TextView(this).getTextSize();
TextView txt = (TextView) findById(R.id.text); float size = txt.getTextSize();
这应该在现有的上做