我正在使用 This - PROJECT
MainActivity.java
public class MainActivity extends Activity {
protected static final String TAG = null;
private TextView txtStart,txtEnd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
txtStart= (TextView) findViewById(R.id.edt_starttime);
txtEnd= (TextView) findViewById(R.id.edt_endtime);
// create RangeSeekBar as Integer range between 20 and 75
RangeSeekBar<Integer> seekBar = new RangeSeekBar<Integer>(100, 1500, this);
seekBar.setOnRangeSeekBarChangeListener(new OnRangeSeekBarChangeListener<Integer>() {
@Override
public void onRangeSeekBarValuesChanged(RangeSeekBar<?> bar,
Integer minValue, Integer maxValue) {
// handle changed range values
String powerranger = "User selected new range values: MIN=" + minValue + ", MAX=" + maxValue;
//Log.i(TAG, powerranger);
//textView1.setText(powerranger);
txtStart.setText(String.valueOf(minValue));
txtEnd.setText(String.valueOf(maxValue));
}
});
// add RangeSeekBar to pre-defined layout
ViewGroup layout = (ViewGroup) findViewById(R.id.layout);
layout.addView(seekBar);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
RangeSeekBar.java 我已经from here
注意::我无法发布完整代码,因为代码超出了网站允许的最大字符 RangeSeekBar.java
输出 ::
我面临的问题 ::
答案 0 :(得分:8)
我快速查看了代码,似乎RangeSeekBar
类具有notifyWhileDragging
属性,您必须将其设置为true
才能获得所需内容(它是{默认情况下为{1}}。