Android SimpleExoPlayerView自定义,以保持背景透明和控件始终可见
我正在使用Android SimpleExoPlayerView自定义,以保持背景透明和控件始终可见,android,android-layout,exoplayer,exoplayer2.x,Android,Android Layout,Exoplayer,Exoplayer2.x,我正在使用ExoPlayer播放音频歌曲,下面是我的SimpleExoPlayerView的样子: <com.google.android.exoplayer2.ui.SimpleExoPlayerView android:id="@+id/video_view" android:layout_width="match_parent" android:layout_height="wrap_content" /> 结果: 要求: 如何保持SimpleExoPlay
ExoPlayer
播放音频歌曲,下面是我的SimpleExoPlayerView
的样子:
<com.google.android.exoplayer2.ui.SimpleExoPlayerView
android:id="@+id/video_view"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
结果:
要求:
SimpleExoPlayerView
背景透明,而不是黑色背景[我得到的仍然是](见上面的屏幕截图)SimpleExoPlayerView
始终可见(在我再次触摸之前,它始终显示然后消失)您可以将
show\u timeout
设置为0以避免隐藏控件(也可以将hide\u on\u touch
设置为false)
您还可以定义自己的
controller\u layout\u id
layout,它将为您提供对后台等所需的所有控制(可以使用默认值作为起点)。在onCreate()方法上尝试以下代码:
关于此问题的“保持背景透明”方面,您可能将控件背景的背景设置为透明,但仍会在播放控件视图上看到黑色背景
原因是…不是你的背景是黑色的
版面中的该死的百叶窗视图仍然可见/有黑色背景
要更改XML格式,请向PlayerView XML添加以下属性:
app:shutter_background_color="@color/transparent"
要完全删除视图,可以执行以下操作:
((ViewGroup)shutterView.getParent()).removeView(shutterView);
我尝试使用自定义版面,但仍然变黑作为背景您是否对自定义版面进行了更改以指定透明背景的使用?我刚刚注意到,除了播放和暂停,所有按钮都在工作,就像播放歌曲一样,仍然可以看到暂停按钮,现在尝试点击它,暂停它,但是click没有响应为什么以及如何解决它?@Sophie不确定tbh…我也在使用上面的代码,但没有看到这个问题。是否有可能在布局xml中禁用它?
app:shutter_background_color="@color/transparent"
((ViewGroup)shutterView.getParent()).removeView(shutterView);