热门标签 | HotTags
当前位置:  开发笔记 > Android > 正文

音量控制键控制的音频流(setVolumeControlStream)描述

当开发多媒体应用或者游戏应用的时候,需要使用音量控制键来设置程序的音量大小,在Android系统中有多种音频流,感兴趣的朋友可以了解下
当开发多媒体应用或者游戏应用的时候,需要使用音量控制键来设置程序的音量大小。在Android系统中有多中音频流,通过Activity中的函数 setVolumeControlStream(int streamType)可以设置该Activity中音量控制键控制的音频流,一般在onCreate函数中设置。

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函数描述

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 .
推荐阅读
  • FroggerTimeLimit:1000MSMemoryLimit:65536KTotalSubmissions:32257Accepted:10396DescriptionFr ... [详细]
  • 转自:http:malideveloper.arm.comcndevelop-for-malisample-codeetcv1-texture-compression-and-alpha- ... [详细]
  • 本文分析和介绍了GLo ... [详细]
  • 代码:在mysql5.6,运行正常,5.7报错SELECTsum((selecta.numwherea.status1))astotalFROMmes_order_productA ... [详细]
  • 2019.4.14第1001题:SumProblemProblemDescriptionHey,welcometoHDOJ(HangzhouDianziUniversityOnli ... [详细]
  • Git(1)
    安装Git完毕(在开始菜单打开的话,打开的不是你想要的路径,切换路径很麻烦)1.D盘新建GitTest文件夹2.打开GitTest,在空白的地方右键,3.单击GitBashHere ... [详细]
  • python基础(二、pycharm安装、卸载)
    3.在Ubuntu中安装PyCharmPyCharm的官方网站地址是:https:www.jetbrains.compycharm注意:安装时不要使用root用户安装,否则后期使用 ... [详细]
  • 在Android源码环境下编译系统App使用第三方jar包的方法(备忘)
    1将要使用的jar包放入App的根目录,即Android.mk所在目录2按如下方式编写Android.mk文件(########之间的行用于编译和使用jar包)LOCAL_PATH:$(ca ... [详细]
  • 这一篇主要总结一下jQuery这个js在引入的时候做的一些初始化工作第一句window.undefinedwindow.undefined;是为了兼容低版本的IE而写的因为在低版本 ... [详细]
  • spotify engineering culture part 1
    原文,因为原视频说的太快太长,又没有字幕,于是借助youtube,把原文听&打出来了。中文版日后有时间再翻译。oneofthebigsucceessfactorshereatSpo ... [详细]
  • MyBatis模糊查询和多条件查询一、ISmbmsUserDao层根据姓名模糊查询publicListgetUser();多条件查询publicList ... [详细]
  • 载波|等份_NR SRS时频域位置
    篇首语:本文由编程笔记#小编为大家整理,主要介绍了NRSRS时频域位置相关的知识,希望对你有一定的参考价值。微信同步更新欢迎关注同名modem协议笔记S ... [详细]
  • Mac下Flutter安装AndroidStudio配置
    补一个Mac下Flutter安装AndroidStudio配置(官网地址:https:flutter.devdocsget-startedinstallmacos)1.下载安装包; ... [详细]
  • vscode里的html标签导航的一系列问题
    哈喽,我今天带来的经验是,vscode在18年10月更新后的1.29以后,编辑html文档时,会发现最上面有个类似于HTML标签导航的玩意儿,可能部分同学和我一样不习惯用它们,现在 ... [详细]
  • Android Rxbus事件总线
    我的视频课程:《FFmpeg打造Android万能音频播放器》最近在项目中使用了Rxjava和RxAndroid,确实感觉挺不错的,然后听说可以用RxBus来替换 ... [详细]
author-avatar
忘爱LIAN
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有