我希望将YouTubePlayerFragment覆盖在视频的自定义listView上,但出现错误[不幸的是,应用程序停止了。]。这是我的布局文件:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="20dip">
<EditText
android:id="@+id/userId"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:imeOptions="actionGo"
android:inputType="text" />
<Button
android:id="@+id/searchButton"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:onClick="getUserYouTubeFeed"
android:text="Click to Search" />
<com.gagan.ui.widget.VideosListView
android:id="@+id/videosListView"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<com.gagan.ui.widget.VideosListView
android:id="@+id/videosListViewHistory"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<com.gagan.ui.widget.VideosListView
android:id="@+id/videosListViewFavourite"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
<fragment
android:name="com.google.android.youtube.player.YouTubePlayerFragment"
android:id="@+id/youtube_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</FrameLayout >
活动代码:
youTubePlayerFragment.getView().setVisibility(View.VISIBLE);
fm.beginTransaction().setCustomAnimations(R.anim.fade_in,R.anim.fade_out);
fm.beginTransaction().add(R.id.videosListView,youTubePlayerFragment,"yt_id1");
fm.beginTransaction().addToBackStack(null);
fm.beginTransaction().commit();
player.setPlayerStateChangeListener(playerStateChangeListener);
this.playerInstance = player;
//player.cueVideo(videoID);
player.loadVideo(videoID);
我对感兴趣:
1)有更正吗? 1)我想念什么吗? 2)有更好的设计或替代方案吗?
感谢和问候!