音量控制鍵控制的音頻流(setVolumeControlStream)描述
更新時間:2013年01月18日 17:57:55 作者:
當(dāng)開發(fā)多媒體應(yīng)用或者游戲應(yīng)用的時候,需要使用音量控制鍵來設(shè)置程序的音量大小,在Android系統(tǒng)中有多種音頻流,感興趣的朋友可以了解下
當(dāng)開發(fā)多媒體應(yīng)用或者游戲應(yīng)用的時候,需要使用音量控制鍵來設(shè)置程序的音量大小。在Android系統(tǒng)中有多中音頻流,通過Activity中的函數(shù) setVolumeControlStream(int streamType)可以設(shè)置該Activity中音量控制鍵控制的音頻流,一般在onCreate函數(shù)中設(shè)置。
Android中有如下幾種音頻流:
•AudioManager.STREAM_MUSIC /** The audio stream for music playback */
•AudioManager.STREAM_RING /** The audio stream for the phone ring */
•AudioManager.STREAM_ALARM /** The audio stream for alarms */
•AudioManager.STREAM_NOTIFICATION /** The audio stream for notifications */
•AudioManager.STREAM_SYSTEM /** The audio stream for system sounds */
•AudioManager.STREAM_VOICECALL /** The audio stream for phone calls */
setVolumeControlStream函數(shù)描述:
void android.app.Activity .setVolumeControlStream(int streamType)
Suggests an audio stream whose volume should be changed by the hardware volume controls.
The suggested audio stream will be tied to the window of this Activity. If the Activity is switched, the stream set here is no longer the suggested stream. The client does not need to save and restore the old suggested stream value in onPause and onResume.
Parameters:
streamType The type of the audio stream whose volume should be changed by the hardware volume controls. It is not guaranteed that the hardware volume controls will always change this stream's volume (for example, if a call is in progress, its stream's volume may be changed instead). To reset back to the default, use AudioManager.USE_DEFAULT_STREAM_TYPE .
Android中有如下幾種音頻流:
•AudioManager.STREAM_MUSIC /** The audio stream for music playback */
•AudioManager.STREAM_RING /** The audio stream for the phone ring */
•AudioManager.STREAM_ALARM /** The audio stream for alarms */
•AudioManager.STREAM_NOTIFICATION /** The audio stream for notifications */
•AudioManager.STREAM_SYSTEM /** The audio stream for system sounds */
•AudioManager.STREAM_VOICECALL /** The audio stream for phone calls */
setVolumeControlStream函數(shù)描述:
void android.app.Activity .setVolumeControlStream(int streamType)
Suggests an audio stream whose volume should be changed by the hardware volume controls.
The suggested audio stream will be tied to the window of this Activity. If the Activity is switched, the stream set here is no longer the suggested stream. The client does not need to save and restore the old suggested stream value in onPause and onResume.
Parameters:
streamType The type of the audio stream whose volume should be changed by the hardware volume controls. It is not guaranteed that the hardware volume controls will always change this stream's volume (for example, if a call is in progress, its stream's volume may be changed instead). To reset back to the default, use AudioManager.USE_DEFAULT_STREAM_TYPE .
相關(guān)文章
Android-Service實現(xiàn)手機(jī)壁紙自動更換
這篇文章主要為大家詳細(xì)介紹了Android-Service實現(xiàn)手機(jī)壁紙自動更換,具有一定的參考價值,感興趣的小伙伴們可以參考一下2018-11-11
Android用PopupWindow實現(xiàn)自定義overflow
這篇文章主要介紹了Android用PopupWindow實現(xiàn)自定義overflow的相關(guān)資料,具有一定的參考價值,感興趣的小伙伴們可以參考一下2016-11-11
探究Android中ListView復(fù)用導(dǎo)致布局錯亂的解決方案
這篇文章主要介紹了探究Android中ListView復(fù)用導(dǎo)致布局錯亂的解決方案,非常不錯,具有參考借鑒價值,需要的朋友可以參考下2016-10-10
Android中ContentProvider和ContentResolver詳解
這篇文章主要介紹了Android中ContentProvider和ContentResolver詳解的相關(guān)資料,需要的朋友可以參考下2017-04-04
Android IPC機(jī)制Messenger實例詳解
這篇文章主要介紹了 Android IPC機(jī)制Messenger實例詳解的相關(guān)資料,需要的朋友可以參考下2017-07-07

