android.view.Window.setVolumeControlStream()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(1.8k)|赞(0)|评价(0)|浏览(87)

本文整理了Java中android.view.Window.setVolumeControlStream()方法的一些代码示例,展示了Window.setVolumeControlStream()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Window.setVolumeControlStream()方法的具体详情如下:
包路径:android.view.Window
类名称:Window
方法名:setVolumeControlStream

Window.setVolumeControlStream介绍

暂无

代码示例

代码示例来源:origin: Dawish/BriskTVLauncher

private void initFloatingWindow() {
  mWindowManager = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE);
  mWindow = PolicyCompat.createWindow(mContext);
  mWindow.setWindowManager(mWindowManager, null, null);
  mWindow.requestFeature(Window.FEATURE_NO_TITLE);
  mDecor = mWindow.getDecorView();
  mDecor.setOnTouchListener(mTouchListener);
  mWindow.setContentView(this);
  mWindow.setBackgroundDrawableResource(android.R.color.transparent);
  
  // While the media controller is up, the volume control keys should
  // affect the media stream type
  mWindow.setVolumeControlStream(AudioManager.STREAM_MUSIC);
  setFocusable(true);
  setFocusableInTouchMode(true);
  setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
  requestFocus();
}

代码示例来源:origin: Dreamxiaoxuan/AndroidTvDemo

private void initFloatingWindow()
{
  mWindowManager = (WindowManager)mContext.getSystemService(Context.WINDOW_SERVICE);
  mWindow = PolicyCompat.createWindow(mContext);
  mWindow.setWindowManager(mWindowManager, null, null);
  mWindow.requestFeature(Window.FEATURE_NO_TITLE);
  mDecor = mWindow.getDecorView();
  mDecor.setOnTouchListener(mTouchListener);
  mWindow.setContentView(this);
  mWindow.setBackgroundDrawableResource(android.R.color.transparent);
  
  // While the media controller is up, the volume control keys should
  // affect the media stream type
  mWindow.setVolumeControlStream(AudioManager.STREAM_MUSIC);
  
  setFocusable(true);
  setFocusableInTouchMode(true);
  setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
  requestFocus();
}

相关文章

微信公众号

最新文章

更多

Window类方法