我是android新手,需要帮助才能使用我之前在stackoverflow上找到的范围搜索条。问题是我无法在拖动两个拇指的文本视图中获取文本值。所需的输出图像为:enter link description here
范围搜索栏的网址是:enter link description here
1: 现在我已经完成了获取最小值和最大值的部分。下一个问题是在搜索栏中具有滑块的自定义值。就像我想要10000,20000,...... 50000,...... 100000 ....等我正在为我的主要班级提供代码。
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// create RangeSeekBar as Integer range between 20 and 75
RangeSeekBar<Integer> seekBar = new RangeSeekBar<Integer>(0, 100000,
getApplicationContext());
seekBar.setOnRangeSeekBarChangeListener(new OnRangeSeekBarChangeListener<Integer>() {
@Override
public void onRangeSeekBarValuesChanged(RangeSeekBar<?> bar,
Integer minValue, Integer maxValue) {
// handle changed range values
Log.i("TAG", "User selected new range values: MIN=" + minValue
+ ", MAX=" + maxValue);
}
});
final TextView tv = new TextView(this);
tv.setText("Val");
ll = (LinearLayout) findViewById(R.id.ll1);
ll.addView(seekBar);
ll.addView(tv);
seekBar.setNotifyWhileDragging(true);
seekBar.setOnRangeSeekBarChangeListener(new OnRangeSeekBarChangeListener<Integer>() {
@Override
public void onRangeSeekBarValuesChanged(RangeSeekBar<?> bar,
Integer minValue, Integer maxValue) {
// TODO Auto-generated method stub
tv.setText("Max:Min"+"\n"+minValue+" : "+maxValue);
}
});