我正在使用此链接https://github.com/Jay-Goo/RangeSeekBar。导入此rangeseekbar模块.how以编程方式设置最小值和最大值。
这里是java代码,
seekbar1.setOnRangeChangedListener(new RangeSeekBar.OnRangeChangedListener() {
@Override
public void onRangeChanged(RangeSeekBar view, float min, float max, boolean isFromUser) {
seekbar1.setProgressDescription((int)min+Sdistance_meter);
int intvalue = (int)Math.round(min);
System.out.println("*********venki****driverradius***"+intvalue);
String mytext=String.valueOf(intvalue);
Tv_res.setText(mytext+Sdistance_meter);
}
});
json回应,
{
"status": "1",
"response": {
"min_value": "1000",
"max_value": "5000",
"coverage_distance": "100",
"distance_meter": "m",
"text": "Area distance coverage by given the value"
}
}
我需要在rangeseekbar中设置min_value和max_value。
答案 0 :(得分:2)
在图书馆的来源。
Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory);
String Root = Directory.GetCurrentDirectory();
所以你可以使用public void setRange(float min, float max) {
setRules(min, max, reserveCount, cellsCount);
}
1.如果您使用seekbar1.setRange(min_value,max_value);
XML
app:seekBarMode="single"
的java
<com.jaygoo.widget.RangeSeekBar
android:id="@+id/seekbar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:markTextArray="@array/markArray"
app:lineColorSelected="@color/colorAccent"
app:thumbResId="@drawable/seekbar_thumb"
app:lineColorEdge="@color/colorSeekBarDefault"
app:cellMode="number"
app:seekBarMode="single"/>
2.如果您使用seekbar1 = (RangeSeekBar) findViewById(R.id.seekbar1);
seekbar1.setRange(1000.0f, 5000.0f);
seekbar1.setOnRangeChangedListener(new RangeSeekBar.OnRangeChangedListener() {
@Override
public void onRangeChanged(RangeSeekBar view, float min, float max, boolean isFromUser) {
seekbar1.setProgressDescription((int) min + "%");
}
});
删除xml代码中的app:seekBarMode="range"
和app:progressHintMode="alwaysShow"
。
app:min="-1" app:max="1"
的java
<com.jaygoo.widget.RangeSeekBar
android:id="@+id/seekbar2"
android:layout_width="match_parent"
android:layout_height="120dp"
app:markTextArray="@array/markArray2"
app:lineColorSelected="@color/colorAccent"
app:lineColorEdge="@color/colorSeekBarDefault"
app:textPadding="17dp"
app:thumbPrimaryColor="@color/colorSeekBarDefault"
app:thumbSecondaryColor="@color/colorAccent"
app:seekBarHeight="4dp"
app:thumbSize="20dp"
app:cellMode="number"
app:seekBarMode="range"/>