java当我改变值时,如何自动增加媒体播放器的音量
final float azimuth = Math.round(sensorEvent.values[0]);
float pitch = Math.round(sensorEvent.values[1]);
float role = Math.round(sensorEvent.values[2]);
final double tesla = Math.sqrt((azimuth * azimuth) + (pitch * pitch) + (role * role));
final Handler handler = new Handler();
int i = (int) tesla;
mytext.setText(i + "");
CircularProgressBar circularProgressBar = (CircularProgressBar) findViewById(R.id.progressBar2);
circularProgressBar.setColor(ContextCompat.getColor(this, R.color.errorcolorcircle));
circularProgressBar.setBackgroundColor(ContextCompat.getColor(this, R.color.colorAccent));
circularProgressBar.setProgressBarWidth(getResources().getDimension(R.dimen.activity_vertical_margin));
circularProgressBar.setBackgroundProgressBarWidth(getResources().getDimension(R.dimen.activity_horizontal_margin));
int animationDuration = 200; // 2500ms = 2,5s
circularProgressBar.setProgressWithAnimation(i, animationDuration); // Default duration = 1500ms
我有那个代码,我想在x轴值改变时自动增加媒体播放器的音量。。。表示当x值增大时,音量自动变大,当x值减小时,音量自动变小
共 (0) 个答案