Este es mi xml:
<RelativeLayout 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:padding="16dp"> <com.google.android.youtube.player.YouTubePlayerView android:id="@+id/youtube_view" android:layout_width="wrap_content" android:layout_height="wrap_content" /> </RelativeLayout>Esta es mi actividad de videos
public class VideosActivity extends YouTubeBaseActivity implements YouTubePlayer.OnInitializedListener, YouTubePlayer.PlaybackEventListener {}Cómo agregar la barra de herramientas para esta actividad
Este código solo funciona en un nivel de API superior a 21
en su código de barra de herramientas de lugar XML
<Toolbar android:id="@+id/toolbar" android:layout_width="match_parent" android:layout_height="?attr/actionBarSize" android:background="?attr/colorPrimary" app:layout_scrollFlags="scroll|enterAlways" android:theme="@style/ThemeOverlay.AppCompat.Light" app:popupTheme="@style/AppTheme"> </Toolbar>En tu conjunto YouTubeBaseActivity La barra de herramientas
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setActionBar(toolbar);