
这是代码:
Context context = getActivity(); TypedValue typedValue = new TypedValue(); context.gettheme().resolveAttribute(androID.R.attr.textAppearance,typedValue,true); int[] textSizeAttr = new int[] { androID.R.attr.textSize }; TypedArray a = context.obtainStyledAttributes((AttributeSet) typedValue.string,textSizeAttr); textSize = a.getDimensionPixelSize(0,-1); Log.e("Metrics","text size in dp = " + String.valueOf(textSize)); a.recycle()解决方法 获取textVIEw的文本大小非常简单 这是代码
textVIEw.getTextSize();
返回此TextVIEw中默认文本大小的大小(以像素为单位)
总结以上是内存溢出为你收集整理的在Android中获取默认文本大小(以像素为单位全部内容,希望文章能够帮你解决在Android中获取默认文本大小(以像素为单位所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)