【发布时间】:2019-11-05 10:44:19
【问题描述】:
在Canvas中,用RectF画一个矩形,需要在dp或px中设置top和left吗?
Integer padding = 10;
Integer width = 100; // It is dp or px?
Integer height = 50;
RectF position = new RectF();
position.top = 0 + padding;
position.bottom = position.top + height;
position.left = 0 + padding;
position.right = position.left + width;
http://developer.android.com/intl/es/reference/android/graphics/RectF.html 它不指示这些值是以 px 还是 dp 表示的。
【问题讨论】:
-
canvas 始终使用 px。
-
记录在哪里?