转换毫米像素 [英] Convert mm to pixels
本文介绍了转换毫米像素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有人有一个良好的算法毫米转换为像素在Android?
Does anyone have a good algorithm to convert mm to pixels on Android?
问题是,我希望能够设置使用毫米为单位视图的最小高度。
The thing is, I want to be able to set a minimum height of a View using mm as unit.
和不,我不想使用Android:在了minHeight XML,这应该是在code
And no, I don't want to use android:minHeight in xml, this should be in the code.
推荐答案
转换1mm至像素
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_MM, 1,
getResources().getDisplayMetrics());
这篇关于转换毫米像素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文