oli107 / material-range-bar

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

tickInterval is 100 but rangebar is jumping 600 for first tick. #48

Closed ayushsingla991 closed 8 years ago

ayushsingla991 commented 8 years ago

For first tick left pin is jumping by 600 and after that it is jumping by 100. What's the issue?

<com.appyvet.rangebar.RangeBar xmlns:custom="http://schemas.android.com/apk/res-auto" android:id="@+id/rbPrice" android:layout_width="match_parent" android:layout_height="72dp" android:layout_marginLeft="16dp" android:layout_marginRight="16dp" custom:tickEnd="4000" custom:tickHeight="0sp" custom:tickInterval="100" custom:tickStart="600" />

Full Code:- <RelativeLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:paddingLeft="5sp" android:paddingRight="5sp">

                <TextView
                    android:id="@+id/tvMinPrice"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_centerVertical="true"
                    android:text="₹ 600"
                    android:textColor="@color/black" />

                <com.appyvet.rangebar.RangeBar xmlns:custom="http://schemas.android.com/apk/res-auto"
                    android:id="@+id/rbPrice"
                    android:layout_width="match_parent"
                    android:layout_height="72dp"
                    android:layout_marginLeft="16dp"
                    android:layout_marginRight="16dp"
                    android:layout_toLeftOf="@+id/tvMaxPrice"
                    android:layout_toRightOf="@+id/tvMinPrice"
                    custom:connectingLineColor="@color/colorAccent"
                    custom:pinColor="@color/colorAccent"
                    custom:rangeBarColor="@color/colorAccent"
                    custom:selectorColor="@color/colorAccent"
                    custom:tickColor="@color/colorAccent"
                    custom:tickEnd="4000"
                    custom:tickHeight="0sp"
                    custom:tickInterval="100"
                    custom:tickStart="600" />

                <TextView
                    android:id="@+id/tvMaxPrice"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_alignParentRight="true"
                    android:layout_centerVertical="true"
                    android:text="₹ 4000"
                    android:textColor="@color/black" />

            </RelativeLayout>
ayushsingla991 commented 8 years ago

This is solved by me after doing a little bit tricks. You can put the rangebar into relativelayout. Hence i can't delete my own post if i got the solution. But if anyone is getting this type of problem, please consider doing this.

code: <RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toLeftOf="@+id/tvMaxPrice" android:layout_toRightOf="@+id/tvMinPrice">

                    <com.appyvet.rangebar.RangeBar xmlns:custom="http://schemas.android.com/apk/res-auto"
                        android:id="@+id/rbPrice"
                        android:layout_width="match_parent"
                        android:layout_height="72dp"
                        android:layout_marginLeft="16dp"
                        android:layout_marginRight="16dp"
                        custom:connectingLineColor="@color/colorAccent"
                        custom:pinColor="@color/colorAccent"
                        custom:rangeBarColor="@color/colorAccent"
                        custom:selectorColor="@color/colorAccent"
                        custom:tickColor="@color/colorAccent"
                        custom:tickEnd="4000"
                        custom:tickHeight="0sp"
                        custom:tickInterval="100"
                        custom:tickStart="600" />
                </RelativeLayout>