I have two SeekBar in my opinion and I declare them similarly in the layout:
<SeekBar android:id="@+id/select_price" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="5dp" /> <TextView android:id="@+id/max_price" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0 VND" android:layout_gravity="center" /> <LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="20dp" android:orientation="horizontal"> <ImageView android:layout_width="20dp" android:layout_height="20dp" android:src="@drawable/ic_distance" android:layout_marginRight="5dp" /> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="18sp" android:text="@string/max_distance" /> </LinearLayout> <SeekBar android:id="@+id/select_distance" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="5dp"/> <TextView android:id="@+id/distance" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="0 Km" android:layout_gravity="center" />
And here is the code in which I use them:
SeekBar sb = (SeekBar) v.findViewById(R.id.select_price); sb.setMax(1000); sb.setProgress(10); sb.setOnSeekBarChangeListener(new OnSeekBarChangeListener(){ @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { TextView text = (TextView) v.findViewById(R.id.max_price); text.setText(Integer.toString(progress) + PlaceListActivity.this.getResources().getString(R.string.dong)); maxPrice = progress; } @Override public void onStartTrackingTouch(SeekBar seekBar) {
But when I debug the application on my device, the first search bar is fine, and the other becomes weird, and I don't know why. This is a screenshot:

As you can see, the starting point in the first bar is not from the very beginning. What could be the reason for this? I really hope someone can help me with this. Thanks.
source share