Monday, April 25, 2011

[android-developers] what's the unit of "setStrokeWidth()" (dp or pixel)

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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate