Is it possible by pressing a button in my Activity to make the volume bar appear? The volume bar is the view that appears when you press one of the hardware volume buttons.
Is there a API function to do this or do I have to recreate that view by hand?
if you call setStreamVolume, pass the flag FLAG_SHOW_UI See http://developer.android.com/reference/android/media/AudioManager.html#FLAG_SHOW_UI
Working code
AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
audio.adjustStreamVolume(AudioManager.STREAM_MUSIC,
AudioManager.ADJUST_SAME, AudioManager.FLAG_SHOW_UI);
来源:https://stackoverflow.com/questions/3581722/trigger-system-volume-bar