2016-07-27 21 views
0
  • 我試圖加載的縮略圖使用滑翔, 在網絡上的文章,但它返回一個空場網站的網址加載縮略圖。
  • 與其他示例不同,此URL不直接鏈接到PNG/JPG 等,而是它的一個網站鏈接,我需要它加載 默認縮略圖。
  • 已將ImageView設置爲&正確初始化。
  • 我已經使用Glide &畢加索在單獨的嘗試,但它的 ImageView是空白的。

片段Android的 - 利用滑行/畢加索

ivGlide = (ImageView) findViewById(R.id.ivGlide); 

String uriLoad = "http://www.recode.net/2016/7/26/12281110/facebook-video-360-degree-camera"; 

//USING GLIDE 
Glide.with(Activity_glidetest.this) 
.load(uriLoad) 
.centerCrop() 
.into(ivGlide); 

    //USING PICASSO 
    Picasso.with(Activity_frienddetail.this) 
    .load(uriLoad) 
    .resize(78, 78) 
    .centerCrop() 
    .into(ivGlide); 

XML

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" > 

    <ImageView 
     android:id="@+id/ivGlide" 
     android:layout_width="78dp" 
     android:layout_height="78dp" 
     android:src="@drawable/hand" 
     android:layout_centerInParent="true" /> 

</RelativeLayout> 
+0

您是否在清單中提供? – Nisarg

+0

該網址不是圖片網址,您應該傳遞給Glide/Picasso圖片網址 – Chol

+0

在您的示例中,它應該是:https://cdn1.vox-cdn.com/thumbor/0LIdoMHrI6QiVjaB00iZCQY17lQ=/800x533/filters:focal( 2592x1241:3444x2093):no_upscale()/ cdn1.vox-cdn.com/uploads/chorus_image/image/50207157/Surround360_1.0.jpg – Chol

回答

0

您需要提供滑翔/畢加索直接鏈接到文章的形象。嘗試找到這個網站的API,或使用一些「任何網站到API」工具,我相信它會給你的文章圖像。

+0

有沒有什麼代碼可以在Android上分享如何做到這一點? – Zen