Android YotubePlayer自定义控制器
我想为玩家定制控制器。在纵向中,我将播放器放置在FrameLayout中,设置player.setPlayerStyle(YouTubePlayer.PlayerStyle.CHROMELESS)并将自定义视图放置在播放器视图上(使用填充等)。但我如何在全屏模式下做到这一点Android YotubePlayer自定义控制器,android,youtube-api,android-youtube-api,Android,Youtube Api,Android Youtube Api,我想为玩家定制控制器。在纵向中,我将播放器放置在FrameLayout中,设置player.setPlayerStyle(YouTubePlayer.PlayerStyle.CHROMELESS)并将自定义视图放置在播放器视图上(使用填充等)。但我如何在全屏模式下做到这一点 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com
<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>
添加到@Android的答案中
是的,这是正确的。使用此按钮可以通知玩家它正在全屏布局。调用此函数可能会影响玩家控件的外观,更改布局以更好地适应当前玩家的大小
调用“youtubeplyer.onFullScreenStener”将触发“onFullscreen()事件。只需设置setFullscreen(布尔全屏)。设置播放器后style@Android当我设置CHROMLESS style时,全屏模式下没有默认控件,我的自定义控件不存在。是的,没有任何默认控件,您必须创建自己的控件。请显示您尝试的代码。@d.datul1990 Hi。不,我知道YouTubePlayer不允许在其上放置其他视图。所以我决定使用默认控件