小编Jav*_*oob的帖子

YouTubeThumbnailView示例

我正在尝试使用YouTubeThumbnailView为一系列YouTube视频设置多个缩略图.问题是相同的缩略图重复过来所以我正在寻找一个如何实现这一目标的例子.

我试图谷歌搜索问题,但我只能找到一个缩略图的例子 - 我只是在寻找一个如何设置多个(正确)的例子.

YouTubeThumbnailView文档:

https://developers.google.com/youtube/android/player/reference/com/google/android/youtube/player/YouTubeThumbnailView

以前(不成功)尝试:

YouTube API无法按预期播放视频

java youtube video android youtube-api

2
推荐指数
1
解决办法
3264
查看次数

YouTubeThumbnailView上的android:layout_width ="fill_parent"不填充父级

我不确定为什么,但我试图设置我的缩略图的大小来填充父母,但它似乎没有出现他们这样做,我不确定为什么.

我已将参数设置为(我相信)它们应该是,但缩略图仍然不会延伸到屏幕的边缘.

屏幕截图

在此输入图像描述

XML

 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    tools:context=".MainActivity" >

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:autoLink="web"
        android:textStyle="bold" />

    <ScrollView
        android:layout_width="match_parent"
        android:layout_height="match_parent" 
        android:id="@+id/groupScrollView">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <com.google.android.youtube.player.YouTubePlayerView
                android:id="@+id/youtubeplayerview"
                android:layout_width="match_parent"
                android:layout_height="wrap_content" />

            <TextView
                android:id="@+id/textView1a"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Throw &apos;Em Up"
                android:textAppearance="?android:attr/textAppearanceMedium" />

            <TextView
                android:id="@+id/textView2a"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="by DJ Generic"
                android:textAppearance="?android:attr/textAppearanceSmall" />

            <TextView
                android:id="@+id/textView3a"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="100,000 views"
                android:textAppearance="?android:attr/textAppearanceSmall" />

            <com.google.android.youtube.player.YouTubeThumbnailView
                android:id="@+id/youtubethumbnailview1"
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:padding="5dp" />

            <TextView
                android:id="@+id/textView1b"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Bulls On Parade"
                android:textAppearance="?android:attr/textAppearanceMedium" />

            <TextView
                android:id="@+id/textView2b"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="by Rage …
Run Code Online (Sandbox Code Playgroud)

xml android-ui xml-layout android-youtube-api

0
推荐指数
1
解决办法
1485
查看次数