0
我想为播放器制作自定义控制器。在纵向方向上,我将播放器放置在FrameLayout中,设置player.setPlayerStyle(YouTubePlayer.PlayerStyle.CHROMELESS)
并在播放器视图上放置自定义视图(使用填充等)。但我怎么能在FullScreenMode中做到这一点?YotubePlayer自定义控制器
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<FrameLayout
android:id="@+id/yvPlayer"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:transitionName="@string/transition_id"
android:visibility="visible" />
<android.support.v7.widget.AppCompatImageView
android:id="@+id/video_play_btn"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_centerInParent="true"
android:clickable="true"
app:srcCompat="@drawable/play_circle"
tools:background="@drawable/play_circle" />
<LinearLayout
android:id="@+id/video_information"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignBottom="@id/yvPlayer"
android:layout_marginEnd="@dimen/activity_horizontal_margin"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:layout_marginStart="@dimen/activity_horizontal_margin"
android:orientation="horizontal">
<TextView
android:id="@+id/video_current_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/activity_horizontal_margin"
android:layout_marginRight="10dp"
android:text="00:01"
android:textColor="@color/white_color" />
<org.adw.library.widgets.discreteseekbar.DiscreteSeekBar
android:id="@+id/video_seekBar"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:layout_weight="1"
app:dsb_indicatorColor="@color/pink_color"
app:dsb_min="1"
app:dsb_progressColor="@color/pink_color"
app:dsb_rippleColor="@color/pink_color"
app:dsb_trackColor="@color/grey_transparent_color" />
<TextView
android:id="@+id/video_length"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginRight="10dp"
android:text="99:99"
android:textColor="@color/white_color" />
<android.support.v7.widget.AppCompatImageView
android:id="@+id/video_fullscreen"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical|right"
android:layout_marginRight="@dimen/activity_horizontal_margin"
android:clickable="true"
app:srcCompat="@drawable/fullscreen" />
</LinearLayout>
</RelativeLayout>
<include
android:id="@+id/video_bar"
layout="@layout/transparent_layout" />
</FrameLayout>
只需设置setFullscreen(布尔全屏)。设置了球员风格 – curiousMind
@Android当我设置CHROMLESS风格时,在全屏模式下没有默认控件,我的自定义控件缺席 – Yamko
是的,没有任何默认控件,你必须创建你自己的.please显示你的代码片段你试过了。 – curiousMind