java怎么实现音乐播放器进度条显示音量高低
1个回答
展开全部
//变量:
private SeekBar seekbar;
private MediaPlayer player = null;
player = new MediaPlayer();//初始化
seekbar.setMax(player.getDuration());//设进度条显示
//音量:
audioManager=(AudioManager)getSystemService(AUDIO_SERVICE);
int MaxSound=audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
maxVolumeTextView.setText(String.valueOf(MaxSound));
SoundseekBar.setMax(MaxSound);
int currentSount=audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
SoundseekBar.setProgress(currentSount);
SoundseekBar.setOnSeekBarChangeListener(new SeekBarListener());
ProceseekBar2.setOnSeekBarChangeListener(new ProcessBarListener());
private SeekBar seekbar;
private MediaPlayer player = null;
player = new MediaPlayer();//初始化
seekbar.setMax(player.getDuration());//设进度条显示
//音量:
audioManager=(AudioManager)getSystemService(AUDIO_SERVICE);
int MaxSound=audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
maxVolumeTextView.setText(String.valueOf(MaxSound));
SoundseekBar.setMax(MaxSound);
int currentSount=audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
SoundseekBar.setProgress(currentSount);
SoundseekBar.setOnSeekBarChangeListener(new SeekBarListener());
ProceseekBar2.setOnSeekBarChangeListener(new ProcessBarListener());
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询