0
我嘗試將圖像URL加載到圖像視圖時遇到了一個奇怪的問題。使用Glide或Picasso將png圖像URL加載到ImageView時遇到問題
該圖像是一個PNG。從可繪製文件夾加載圖像時,以下工作正常:
backdrop = (ImageView) findViewById(R.id.backdrop);
Glide.with(this).load(R.drawable.nike_shoes.png).into(backdrop);
但是,以下原因根本不起作用。我試着滑翔和畢加索:
backdrop = (ImageView) findViewById(R.id.backdrop);
String url = "http://41.media.tumblr.com/tumblr_lpzremYbtp1qeto98o1_1280.png";
Glide.with(this).load(url).into(backdrop);
圖像查看XML看起來是這樣的:
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="@dimen/detail_backdrop_height"
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
android:fitsSystemWindows="true">
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/collapsing_toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_scrollFlags="scroll|exitUntilCollapsed"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:expandedTitleMarginStart="48dp"
app:expandedTitleMarginEnd="64dp">
<ImageView
android:id="@+id/backdrop"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerCrop"
android:fitsSystemWindows="true"
app:layout_collapseMode="parallax" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
app:layout_collapseMode="pin" />