AFAIK, every measurement in Android is in pixels.  When you define
something in dp or whatever else in dimens.xml or in your layout, they
get converted to pixels.  The easit way to do it is to define your
measurements in dimens.xml and that way you can use whatever UOM you
want and the system will take care of the conversion for you.

On Apr 26, 11:50 am, xeagle <[email protected]> wrote:
> Hi,
>
> I need draw a "dotted line" in my app. I use codes below:
>         Paint paint = new Paint();
>         paint.setColor(0xff00b900);
>         paint.setStyle(Paint.Style.STROKE);
>         paint.setStrokeWidth(1);
>         paint.setPathEffect(new DashPathEffect(new float[] {5, 5, 5,
> 5}, 1));
>         canvas.drawLine(0, 50, 160, 50, paint);
>
> Now I'd like know the unit of parameter of "setStrokeWidth". Is it dp
> or pixel? If the unit is "dp", will the line seems same width in
> devices with different DPI?
> I test it on emulator and my phone, it seems that "x,y" coordinate of
> "drawLine" is "dp".
>
> Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to