【发布时间】:2014-04-19 23:40:21
【问题描述】:
我希望将 YouTubePlayerFragment 覆盖在我的自定义视频列表视图上,但我收到错误 [应用不幸停止].. 这是我的布局文件:
<?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) 有更好的设计或替代方案吗?
感谢和问候!
【问题讨论】:
标签: java android youtube-api