+-
如何为Paint.setTextSize()设置单位
是否可以更改Paint.setTextSize()的单位?据我所知,它是像素,但我喜欢在DIP中设置文本大小以支持多屏幕.
最佳答案
像这样转换它

// The gesture threshold expressed in dip
private static final float GESTURE_THRESHOLD_DIP = 16.0f;

// Convert the dips to pixels
final float scale = getContext().getResources().getDisplayMetrics().density;
mGestureThreshold = (int) (GESTURE_THRESHOLD_DIP * scale + 0.5f);

// Use mGestureThreshold as a distance in pixels

从这里http://developer.android.com/guide/practices/screens_support.html#dips-pels

点击查看更多相关文章

转载注明原文:如何为Paint.setTextSize()设置单位 - 乐贴网