如何从exoplayer中删除搜索栏 [英] How to remove seek bar from exoplayer
问题描述
我正在使用Exo Player 包装器库来集成视频.我需要做的就是从视频中禁用搜索栏.
I am using Exo Player wrapper library to integrate a video. All i need is to disable seekbar from the video.
我尝试了 videoView.setMediaController(null);
,但是exo播放器没有 MediaController
I tried videoView.setMediaController(null);
, but exo player does not have MediaController
推荐答案
您只需创建名为 exo_playback_control_view.xml
的布局并覆盖常规XML即可.
You can do it simply by creating a layout named: exo_playback_control_view.xml
and override the regular XML.
下面这是标准XML,您可以为 DefaultTimeBar
添加 android:visiblite ="invisible"
,这是我认为您要隐藏的内容,如果不随意,可以根据需要进行更改.
On this one below is the standard XML, You can add android:visiblite="invisible"
for DefaultTimeBar
which is what I think you're trying to hide, if not feel free change it as you want.
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2016 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layoutDirection="ltr"
android:background="#CC000000"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:paddingTop="4dp"
android:orientation="horizontal">
<ImageButton android:id="@id/exo_prev"
style="@style/ExoMediaButton.Previous"/>
<ImageButton android:id="@id/exo_rew"
style="@style/ExoMediaButton.Rewind"/>
<ImageButton android:id="@id/exo_repeat_toggle"
style="@style/ExoMediaButton"/>
<ImageButton android:id="@id/exo_play"
style="@style/ExoMediaButton.Play"/>
<ImageButton android:id="@id/exo_pause"
style="@style/ExoMediaButton.Pause"/>
<ImageButton android:id="@id/exo_ffwd"
style="@style/ExoMediaButton.FastForward"/>
<ImageButton android:id="@id/exo_next"
style="@style/ExoMediaButton.Next"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView android:id="@id/exo_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textStyle="bold"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:includeFontPadding="false"
android:textColor="#FFBEBEBE"/>
<com.google.android.exoplayer2.ui.DefaultTimeBar
android:id="@id/exo_progress"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="26dp"/>
<TextView android:id="@id/exo_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14sp"
android:textStyle="bold"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:includeFontPadding="false"
android:textColor="#FFBEBEBE"/>
</LinearLayout>
</LinearLayout>
对于您的库,您可能想覆盖适当的布局并覆盖它.我不确定是否会奏效,但值得一试.
For your library you might wanna try to override the appropriate layout and override it. I'm not sure if it'll work but it is worth the shot.
- 使用相同的文件名创建布局(如果需要,请布局
layout-21
等...). - 找到您要隐藏的组件,我想它可能是
android:id ="@ + id/exomedia_controls_video_seek"
- 添加
android:visibility ="invisible"
- Create the layout (
layout-21
etc... if needed) with the same file name. - Find the component you want to hide, I think it might be
android:id="@+id/exomedia_controls_video_seek"
- Add
android:visibility="invisible"
这篇关于如何从exoplayer中删除搜索栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!