滑翔不适用于我
glide does not work with me
我不知道为什么 glide 对我不起作用
我是这样说的:
Glide.with(this)
.load("http://api.androidhive.info/images/glide/medium/deadpool.jpg")
.diskCacheStrategy(DiskCacheStrategy.ALL)
.crossFade()
.skipMemoryCache(true)
.into(imgheader);
我也将此添加到我的 gradle 中:
compile 'com.github.bumptech.glide:glide:3.7.0'
还有互联网许可,
我也尝试毕加索,但同样,不起作用!
我该怎么办
我在片段中使用它 & activity 和同样的问题
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.open_new);
toolbarLayout= (CollapsingToolbarLayout) findViewById(R.id.toolbar_layout);
imgheader= (ImageView) findViewById(R.id.imageheader);
titleView=(TextView)findViewById(R.id.title);
infoView=(TextView)findViewById(R.id.info);
Intent intent = getIntent();
title =intent.getStringExtra("title");
date =intent.getStringExtra("date");
info =intent.getStringExtra("info");
imgurl =intent.getStringExtra("imgurl");
id =intent.getIntExtra("id",0);
show =intent.getStringExtra("show");
Toast.makeText(this,imgurl,Toast.LENGTH_LONG).show();
Glide.with(this)
.load(Uri.parse(imgurl))
.diskCacheStrategy(DiskCacheStrategy.ALL)
.crossFade()
.error(R.drawable.desktop)
.skipMemoryCache(true)
.into(imgheader);
imgheader.setVisibility(View.VISIBLE);
titleView.setText(title);
infoView.setText(info);
在我的 xml 中,我有这个:
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:layout_width="match_parent"
android:layout_height="192dp"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax"
android:adjustViewBounds="false"
android:id="@+id/imageheader"
android:src="@drawable/imgtest"
android:textColor="#ffffff" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>
这是我的错,
正确用法:
<uses-permission android:name="android.permission.INTERNET"/>
但我用过:
<permission android:name="android.permission.INTERNET"></permission>
我不知道为什么 glide 对我不起作用 我是这样说的:
Glide.with(this)
.load("http://api.androidhive.info/images/glide/medium/deadpool.jpg")
.diskCacheStrategy(DiskCacheStrategy.ALL)
.crossFade()
.skipMemoryCache(true)
.into(imgheader);
我也将此添加到我的 gradle 中:
compile 'com.github.bumptech.glide:glide:3.7.0'
还有互联网许可, 我也尝试毕加索,但同样,不起作用!
我该怎么办
我在片段中使用它 & activity 和同样的问题
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.open_new);
toolbarLayout= (CollapsingToolbarLayout) findViewById(R.id.toolbar_layout);
imgheader= (ImageView) findViewById(R.id.imageheader);
titleView=(TextView)findViewById(R.id.title);
infoView=(TextView)findViewById(R.id.info);
Intent intent = getIntent();
title =intent.getStringExtra("title");
date =intent.getStringExtra("date");
info =intent.getStringExtra("info");
imgurl =intent.getStringExtra("imgurl");
id =intent.getIntExtra("id",0);
show =intent.getStringExtra("show");
Toast.makeText(this,imgurl,Toast.LENGTH_LONG).show();
Glide.with(this)
.load(Uri.parse(imgurl))
.diskCacheStrategy(DiskCacheStrategy.ALL)
.crossFade()
.error(R.drawable.desktop)
.skipMemoryCache(true)
.into(imgheader);
imgheader.setVisibility(View.VISIBLE);
titleView.setText(title);
infoView.setText(info);
在我的 xml 中,我有这个:
<android.support.design.widget.CollapsingToolbarLayout
android:id="@+id/toolbar_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
app:contentScrim="?attr/colorPrimary"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<ImageView
android:layout_width="match_parent"
android:layout_height="192dp"
android:scaleType="centerCrop"
app:layout_collapseMode="parallax"
android:adjustViewBounds="false"
android:id="@+id/imageheader"
android:src="@drawable/imgtest"
android:textColor="#ffffff" />
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
app:layout_collapseMode="pin"
app:popupTheme="@style/ThemeOverlay.AppCompat.Light" />
</android.support.design.widget.CollapsingToolbarLayout>
这是我的错, 正确用法:
<uses-permission android:name="android.permission.INTERNET"/>
但我用过:
<permission android:name="android.permission.INTERNET"></permission>