flag 参数的含义是什么以及 droid 设备可能的最小和最大范围是多少

2023-11-26

  1. 我想知道什么是标志(或者可能的值是什么 旗)在

    audiomanager.setStreamVolume (int 流类型, int 索引, int 标志);

  2. 我知道我们可以使用获得最大流

    audiomanger.getMaxStream(audioManager.getStreamMax(AudioManager.STREAM_MUSIC));

但在某些设备中它给出 13,15,这取决于 Android 版本或设备硬件以及它的范围(最小可能值,最大可能值)

设置特定流的音量索引。

如果设备实现了 isVolumeFixed() 指示的固定卷策略,则此方法无效。//这是什么意思。

参数

streamType  The stream whose volume index should be set.

index   The volume index to set. See getStreamMaxVolume(int) for the largest valid value.

flags   One or more flags. // what are these flags 

关于flag参数: 有一些标志定义在音频管理器.java。 您可以使用其中任何一种来获得所需的效果。 例子 :

audioManager.setStreamVolume(audioManager.STREAM_MUSIC,progress,AudioManager.FLAG_SHOW_UI);

或者简单地

audioManager.setStreamVolume(audioManager.STREAM_MUSIC,progress,1);

这是来自的代码段音频管理器.java显示它们是如何定义的。

public static final int FLAG_SHOW_UI = 1 << 0;

/**
 * Whether to include ringer modes as possible options when changing volume.
 * For example, if true and volume level is 0 and the volume is adjusted
 * with {@link #ADJUST_LOWER}, then the ringer mode may switch the silent or
 * vibrate mode.
 * <p>
 * By default this is on for the ring stream. If this flag is included,
 * this behavior will be present regardless of the stream type being
 * affected by the ringer mode.
 *
 * @see #adjustVolume(int, int)
 * @see #adjustStreamVolume(int, int, int)
 */
public static final int FLAG_ALLOW_RINGER_MODES = 1 << 1;

/**
 * Whether to play a sound when changing the volume.
 * <p>
 * If this is given to {@link #adjustVolume(int, int)} or
 * {@link #adjustSuggestedStreamVolume(int, int, int)}, it may be ignored
 * in some cases (for example, the decided stream type is not
 * {@link AudioManager#STREAM_RING}, or the volume is being adjusted
 * downward).
 *
 * @see #adjustStreamVolume(int, int, int)
 * @see #adjustVolume(int, int)
 * @see #setStreamVolume(int, int, int)
 */
public static final int FLAG_PLAY_SOUND = 1 << 2;

/**
 * Removes any sounds/vibrate that may be in the queue, or are playing (related to
 * changing volume).
 */
public static final int FLAG_REMOVE_SOUND_AND_VIBRATE = 1 << 3;

/**
 * Whether to vibrate if going into the vibrate ringer mode.
 */
public static final int FLAG_VIBRATE = 1 << 4;

/**
 * Indicates to VolumePanel that the volume slider should be disabled as user
 * cannot change the stream volume
 * @hide
 */
public static final int FLAG_FIXED_VOLUME = 1 << 5;

/**
 * Indicates the volume set/adjust call is for Bluetooth absolute volume
 * @hide
 */
public static final int FLAG_BLUETOOTH_ABS_VOLUME = 1 << 6;

/**
 * Adjusting the volume was prevented due to silent mode, display a hint in the UI.
 * @hide
 */
public static final int FLAG_SHOW_SILENT_HINT = 1 << 7;

/**
 * Indicates the volume call is for Hdmi Cec system audio volume
 * @hide
 */
public static final int FLAG_HDMI_SYSTEM_AUDIO_VOLUME = 1 << 8;

/**
 * Indicates that this should only be handled if media is actively playing.
 * @hide
 */
public static final int FLAG_ACTIVE_MEDIA_ONLY = 1 << 9;

/**
 * Like FLAG_SHOW_UI, but only dialog warnings and confirmations, no sliders.
 * @hide
 */
public static final int FLAG_SHOW_UI_WARNINGS = 1 << 10;

/**
 * Adjusting the volume down from vibrated was prevented, display a hint in the UI.
 * @hide
 */
public static final int FLAG_SHOW_VIBRATE_HINT = 1 << 11;

/**
 * Adjusting the volume due to a hardware key press.
 * @hide
 */
public static final int FLAG_FROM_KEY = 1 << 12;
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

flag 参数的含义是什么以及 droid 设备可能的最小和最大范围是多少 的相关文章

随机推荐

  • 根据构面的存在有条件地修改 ggplot 主题?

    我正在开发一个自定义 ggplot2 主题 并认为根据绘图对象的某些特征自动修改主题元素可能会很漂亮 例如 是否有一种方法可以指定如果绘图包含小平面 则为每个面板添加边框 我想问题确实是 我可以从自定义 theme 调用中访问当前的 gg
  • 拦截浏览器的图片加载请求

    我想知道是否有一种方法可以拦截浏览器的图像加载请求并添加一些服务器期望的请求标头 实际场景是这样的 Web 应用程序向服务器发送 XHR 并完成身份验证握手 所有后续请求都必须包含 auth 标头 由于浏览器不发送图像请求的标头 图像已损坏
  • 扩展 ASP.NET 身份

    似乎这个问题已经以多种方式被问过很多次了 但似乎都不符合我的具体情况 这是我的 LoginPartial cshtml 文件中的一行 Html ActionLink Hello User Identity GetUserName Manag
  • INT 10, 13h 如何与属性一起使用?

    嘿 我试图理解 INT 10h 13h 19 它用 BIOS 中断 10 和 13h 写入字符串 我找到了下面有关放入不同寄存器的不同标志的信息 我仍然不明白的一件事是 BL 中应该包含什么 如果我只是想用这个函数编写一个字符串 BL 中应
  • WCF 命名管道 IPC

    这周我一直在努力加快了解命名管道 我试图用它们解决的任务是我有一个现有的 Windows 服务 它充当设备驱动程序 将数据从外部设备传输到数据库中 现在我必须修改此服务并添加一个可选的用户前端 在同一台机器上 使用 IPC 形式 该前端可以
  • Python 命令行界面中的 Tab 补全 - 如何捕获 Tab 事件

    我正在用 Python 编写一个小 CLI 作为 Mercurial 的扩展 并且希望支持制表符补全 具体来说 我想在提示符中捕获选项卡并显示匹配选项的列表 就像 bash 一样 示例 输入部分名称 ext TAB extensions e
  • 在 Eclipse 中更改安全存储目录 - Windows 上的 user.home 路径问题

    我在 Eclipse 中保存密码时遇到问题 我的密码都没有被 记住 并且我发现 Eclipse 尝试将它们保存在我的 Windows 帐户无权访问的文件夹中 它尝试保存到 D Users Administrator eclipse org
  • 如何获取cardView item在recyclerView中的位置?

    我为回收器创建了一个适配器类 用于在回收器视图中填充卡片视图布局 它工作正常 但是当我单击 recyclerview 中的 cardView 项目时 我需要获取该 cardview 项目的位置 基于此我需要编写一个 Intent 活动 以及
  • 根据 Web.config 键进行 ASP.NET 条件标记渲染

    我在 web config 中有一个密钥
  • com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:通信链接失败软件导致连接中止:recv 失败[重复]

    这个问题在这里已经有答案了 全部 我已经遇到这个问题好几天了 这是详细的堆栈信息 org springframework dao RecoverableDataAccessException Error updating database
  • 使用 java.lang.invoke.MethodHandle 调用私有方法

    如何使用方法句柄调用私有方法 据我所知 只有两种可公开访问的Lookup实例 MethodHandles lookup MethodHandles publicLookup 两者都不允许不受限制的私人访问 还有非公开的Lookup IMPL
  • monad 转换器是否需要访问 monad 的内部结构?

    是否需要访问内部结构 一个 monad 来编写 monad 转换器 例如 我想要GetT 变压器Get来自 Data Binary Get 的 monad 但这个模块没有暴露内部结构Get单子 这是否意味着唯一 对我来说方法是添加GetT直
  • 如何按字母顺序对字符串数组进行排序?

    我有一个由许多字符串组成的数组 如何按字母顺序对字符串进行排序 听起来你只是想使用Array Sort method Array Sort myArray 有许多重载 其中一些重载采用自定义比较器 类或委托 但默认重载应该按照您的意愿按字母
  • 如何在 Spring MVC 中将 @RequestParam 绑定到对象?

    我想通过 AJAX 发出 POST 请求 我还想将整个类对象绑定到该请求 并且我想通过以下方式接收该请求 requestParam注解 我知道可以用 requestBody注释 但我很好奇 我们可以用 requestParam注解 Ajax
  • 使用 SELECT 进行 SQL Server 变量赋值的执行顺序

    给出以下示例 declare i int select i 1 i 2 select i Will i总是2 这是我能想到的最简单的例子 但我正在考虑使用它来交换变量中的值 我还相信这种分配方法 选择 不符合 ANSI 标准 尽管有用 但在
  • Applescript 从当前文件夹启动文件?

    如何打开与 AppleScript 代码位于同一文件夹中的文件 类似的事情吗 tell application QuickTime Player activate open file avi end tell 这不起作用 谢谢 tell a
  • qt - 小部件 - 定位

    我想将一些小部件放置在父小部件中的一些随机位置 例如一个按钮位于点 10 10 处 另一个按钮位于 15 40 处 等等 如何实现这一点 QGridLayout 将所有内容推向行列样式 但我想把小部件放在我想要的任何地方 有人可以帮助我吗
  • 中心无序列表导航栏 - Bootstrap 3

    所以 我试图将我的导航栏列表项居中 由于此任务没有实用函数 因此我设计了以下代码 将无序列表放置在行内的列中 但即使在我尝试使用旧的 text align center 居中后 列表仍然向左对齐 div class navbar navba
  • 这在 lme4 中意味着什么:包“Rcpp”未提供函数“dataptr”

    我正在尝试使用 lme4 执行 LMM 并且弹出此消息 初始化 Ptr 时出错 包 Rcpp 未提供函数 dataptr 我应该怎么办 过了一会儿 我明白了 1 重新安装最新版本的Rcpp是解决方案 2 如果您没有使用lme4 但与 dyn
  • flag 参数的含义是什么以及 droid 设备可能的最小和最大范围是多少

    我想知道什么是标志 或者可能的值是什么 旗 在 audiomanager setStreamVolume int 流类型 int 索引 int 标志 我知道我们可以使用获得最大流 audiomanger getMaxStream audio