oli107 / material-range-bar

Android widget for selecting a range of values.
Apache License 2.0
1.68k stars 370 forks source link

barWeight looks different in different screen densities #29

Open bryant1410 opened 8 years ago

bryant1410 commented 8 years ago

See this, for example:

image

In xxhdpi looks thicker.

Hajzenberg commented 8 years ago

I think the problem is in Connecting line constructor

public ConnectingLine(Context ctx, float y, float connectingLineWeight, int connectingLineColor) {

    final Resources res = ctx.getResources();

    float connectingLineWeight1 = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
            connectingLineWeight,
            res.getDisplayMetrics());

[...] }

I thikn it should be

TypedArray ta = context.obtainStyledAttributes(attrs, R.styleable.RangeBar, 0, 0); float connectingLineWeight1 = ta.getFloat(R.styleable.RangeBar_connectingLineWeight, connectingLineWeight);