我想使用API中的YouTubePlayerFragment在片段中加载YoutubePlayer
我的片段的.xml文件是:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- VIDEO CONTENT -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:paddingLeft="@dimen/layout_horizontal_margin"
android:paddingRight="@dimen/layout_horizontal_margin"
android:paddingTop="@dimen/layout_vertical_margin"
android:paddingBottom="@dimen/layout_vertical_margin" >
<fragment
android:name="com.google.android.youtube.player.YouTubePlayerFragment"
android:id="@+id/youtubeplayer_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</LinearLayout>
<!-- LYRIC CONTENT -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2" >
<LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@drawable/af_background"
android:layout_centerInParent="true" />
<!-- TEXT STRUCTURE -->
<LinearLayout
android:orientation="vertical"
android:id="@+id/lyric_content"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerHorizontal="true" >
<LinearLayout
android:id="@+id/start_layout"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="center_horizontal"
android:layout_centerInParent="true">
<TextView
android:id="@+id/text_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/lyric_margin_top"
android:gravity="center"
android:text="@string/textTitle2"
android:textSize="@dimen/lyric_size"
android:textIsSelectable="false"/>
</LinearLayout>
</LinearLayout>
<!-- …Run Code Online (Sandbox Code Playgroud)