增加的Youtube缩略图大小 [英] Increasing a Youtube Thumbnail Size
问题描述
我从下面的教程进口源:
I've imported the source from the following tutorial:
HTTP://blog.blundell-apps .COM /显示,YouTube的用户,视频-IN-A-列表视图/
https://github.com/blundell/YouTubeUserFeed/tree/master/ RES /布局
但我似乎不能增加缩略图的尺寸 - 我试着从我的XML改变userVideoThumbImageView:
but I cannot seem to increase the size of the thumbnails - I've tried changing userVideoThumbImageView in my XML from:
android:layout_width="wrap_content"
android:layout_height="wrap_content"
到
android:layout_width="80dip"
android:layout_height="80dip"
but it only seems to increase the size of the black space around the thumbnail.
XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal" >
<com.blundell.tut.ui.widget.UrlImageView
android:id="@+id/userVideoThumbImageView"
android:layout_width="80dip"
android:layout_height="80dip"
android:contentDescription="YouTube video thumbnail"
android:src="@drawable/ic_launcher" />
<TextView
android:id="@+id/userVideoTitleTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Video Title Not Found" />
</LinearLayout>
截图:
SCREENSHOT:
推荐答案
这教程是不是所有实现异步任务好。虽然可运行做工精细,在Android中一个的AsyncTask将提供更多的控制。
That tutorial isn't all that good in implementing asynchronous tasks. While runnables work fine, in Android an AsyncTask will provide more control.
现在,您所遇到的问题,我认为,YouTube的各种尺寸提供缩略图,你似乎是拉小的。使用一个较大的帮助,但会慢一些。
Now, for the issue you are having, I believe that youtube provides thumbnails in various sizes, you seem to be pulling the small one. Using a larger one will help but will be slower.
在类GetYouTubeUserVideosTask,你会发现code行
In the class GetYouTubeUserVideosTask, you'll find the line of code
字符串thumbUrl = jsonObject.getJSONObject(缩略图)的getString(sqDefault);
这是拉动正在接收从JSON标准质量的图像,你应该使用高品质的图像。这可以通过改变要实现
It it pulling the Standard Quality image from the JSON being received, you should use the High Quality image. That can be achieved by changing to
字符串thumbUrl = jsonObject.getJSONObject(缩略图)的getString(hqDefault);
您可以做一个样品要求,看到随时将数据通过在URL寻找被使用,回报看起来parcially是这样的:
You can do a sample request and see the data at anytime by looking at the url being used, the return looks parcially like this:
缩略图:{sqDefault: https://开头我。 ytimg.com/vi/NnL0QOtK-o8/default.jpg ,hqDefault:的 https://i.ytimg.com/vi/NnL0QOtK-o8/hqdefault.jpg }
"thumbnail":{"sqDefault":"https://i.ytimg.com/vi/NnL0QOtK-o8/default.jpg","hqDefault":"https://i.ytimg.com/vi/NnL0QOtK-o8/hqdefault.jpg"}
这样,你知道你有多种选择。
That way you know you have various options.
这篇关于增加的Youtube缩略图大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!