android-DecoView-charting icon indicating copy to clipboard operation
android-DecoView-charting copied to clipboard

Line width completely different for different screen sizes

Open MarkOSullivan94 opened this issue 8 years ago • 5 comments

I've noticed a problem when comparing the charts on different screen sizes. While the line width might look perfect on one phone, if you use a phone with a smaller screen size the line width looks too thick.

MarkOSullivan94 avatar Jan 14 '17 11:01 MarkOSullivan94

You have to do something like float decoViewLineWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15, Resources.getSystem().getDisplayMetrics()); so that you're working with dp not pixels - in this example 15dp is the line width

nocturne9op2 avatar Feb 21 '17 03:02 nocturne9op2

@nocturne9op2 tried out your suggestion but this still doesn't look great when scaling. I've taken screenshots when using an emulated Nexus 10 and an emulated Pixel.

I think there'll be complications whenever doing a layout for tablets as you can only specify the line width programmatically

screenshot_1490805111 screenshot_1490805185

MarkOSullivan94 avatar Mar 29 '17 16:03 MarkOSullivan94

I see, I ran into some DecoView proportion issues as well while I was finishing my app. A way around this is to set a different line width for tablets. Android recommends using different xml layouts to suit different screen sizes anyway.

nocturne9op2 avatar Mar 29 '17 20:03 nocturne9op2

Android recommends using different xml layouts to suit different screen sizes anyway.

@nocturne9op2 unfortunately the line width cannot be specified within the XML layouts. If that was the case, it would have made it a lot easier using this library for all different screen sizes.

MarkOSullivan94 avatar Mar 30 '17 07:03 MarkOSullivan94

You should be able to programmatically check whether the device is a phone or tablet, then set the line width accordingly.

nocturne9op2 avatar Apr 01 '17 18:04 nocturne9op2