错误充气类com.google.android.youtube.player.YouTubePlayerView在列表适配器 [英] Error inflating class com.google.android.youtube.player.YouTubePlayerView In List Adapter

查看:558
本文介绍了错误充气类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" />

在列表适配器,这样我可以在ListView它的自我播放视频,但我得到的错误

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 ?

推荐答案

从<一个href=\"https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubePlayerView\"相对=nofollow>文档:

使用该视图是直接使用的替代
   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 extend YouTubeBaseActivity.

因此​​,你必须确保你的活动来延长 YouTubeBaseActivity 。另外,如果你的活动并不需要扩展库提供一个活动,你可以使用 YouTubePlayerSupportFragment 和android.support.v4 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在列表适配器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆