音量控制鍵控制的音頻流(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使用IntentService進行apk更新示例代碼
這篇文章主要介紹了Android使用IntentService進行apk更新示例代碼,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧2018-01-01Android實現(xiàn)仿微軟系統(tǒng)加載動畫效果
這篇文章主要介紹了Android實現(xiàn)仿微軟系統(tǒng)加載動畫效果的方法,幫助大家更好的理解和學(xué)習(xí)使用Android,感興趣的朋友可以了解下2021-04-04Android刮刮樂效果-proterDuffXfermode的示例代碼
這篇文章主要介紹了Android刮刮樂效果-proterDuffXfermode,本文通過實例代碼給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-12-12Android自定義WaveProgressView實現(xiàn)水波紋加載需求
這篇文章主要為大家詳細介紹了Android自定義WaveProgressView實現(xiàn)水波紋加載需求,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-09-09