Error inflating class com.google.android.youtube.player.YouTubePlayerView In List Adapter(在列表适配器中膨胀类 com.google.android.youtube.player.YouTubePlayerView 时出错)
问题描述
我正在尝试充气
<com.google.android.youtube.player.YouTubePlayerView
android:id="@+id/youtubeplayerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp" />
在列表适配器中,以便我可以在列表视图中自行播放视频,但出现错误
in List adapter so that I can play video in the listview it self but I am getting error
膨胀类 com.google.android.youtube.player.YouTubePlayerView 时出错
如果我正在使用
<com.google.android.youtube.player.YouTubeThumbnailView
android:id="@+id/youtubeplayerview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp" />
它正在膨胀而没有任何错误,我可以在列表视图中显示缩略图
It is getting inflated without any error and I am able to display thumbnail in list view
我的要求是当用户点击这个缩略图视频时应该在列表视图中播放
My requirement is when user click on this thumbnail video should play in list view
请建议我怎样才能做到这一点?
Please suggest how can I achieve this ?
推荐答案
来自 文档:
直接使用此视图是使用YouTubePlayerFragment.如果您选择直接使用此视图,您的活动需要扩展 YouTubeBaseActivity.
Using this View directly is an alternative to using the
YouTubePlayerFragment. If you choose to use this view directly, your activity needs to extendYouTubeBaseActivity.
因此,您必须确保您的活动扩展了 YouTubeBaseActivity.或者,如果您的 Activity 不需要扩展库提供的 Activity,您可以使用 android.support.v4 中的 YouTubePlayerSupportFragment 和 FrameActivity.
Therefore, you must make sure your activity extends YouTubeBaseActivity. Alternatively, if your activity does not need to extend an activity provided by the library, you can use the YouTubePlayerSupportFragment and FrameActivity from android.support.v4.
<fragment
android:name="com.google.android.youtube.player.YouTubePlayerSupportFragment"
android:id="@+id/youtubesupportfragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
这篇关于在列表适配器中膨胀类 com.google.android.youtube.player.YouTubePlayerView 时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在列表适配器中膨胀类 com.google.android.youtube.player.YouTubePlayerView 时出错
- 使用自动布局向 UIScrollView 添加动态大小的视图 2022-01-01
- 在 Iphone SDK 的导航栏上添加多个按钮 2022-01-01
- 类似于 Mail.app 的 iPad 模态视图控制器? 2022-01-01
- SetOnItemSelectedListener上的微调程序错误 2022-01-01
- UITextView 内容插图 2022-01-01
- 如何在 iPhone 模拟器中重置 NSUserDefaults 数据? 2022-01-01
- 网上有没有好的 UIScrollView 教程? 2022-01-01
- Xcode 7.3 中带有 UILabel 的 UIStackView 2022-01-01
- GPS状态的广播接收器? 2022-01-01
- URL编码Swift iOS 2022-01-01
