我有两个搜索栏。当我移动拇指2时,我希望看到seekbar one的进展。请帮助 这有可能吗?
android:id="@+id/seekbarone"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:max="100"
android:maxHeight="8dp"
...
android:id="@+id/seekbartwo"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:max="100"
android:maxHeight="8dp"
...
答案 0 :(得分:3)
SeekBar sb1 = (SeekBar) findViewById(R.id.seekbarone);
SeekBar sb2 = (SeekBar) findViewById(R.id.seekbartwo);
sb2.setOnSeekBarChangeListener(new OnSeekBarChangeListener() {
@Override
public void onStopTrackingTouch(SeekBar seekBar) {
}
@Override
public void onStartTrackingTouch(SeekBar seekBar) {
}
@Override
public void onProgressChanged(SeekBar seekBar, int progress,
boolean fromUser) {
sb1.setProgress(progress);
}
});