我有一个带有ImageView的简单布局
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/activity_main"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.vbusovikov.glidetest.MainActivity">
<ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
/>
</RelativeLayout>
这里有一个简单的Glide表达式,可用于将图像加载到此ImageView中,以测试Glide:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ImageView imageView = (ImageView)findViewById(R.id.image);
Glide.with(this)
.load("http://you-ps.ru/uploads/posts/2013-08/1376601606_1273.png")
.error(R.mipmap.ic_launcher)
.into(imageView);
}
然而,出现了错误图标。 可能是什么问题呢? 我在我的网络上使用代理服务器,并且为这种情况准备了适当的 gradle.properties。
systemProp.http.proxyHost=proxy******.ru
systemProp.http.proxyPort=****
即使我试图在没有代理的情况下启动这个小应用程序,它也因某种原因无法工作。
我的 build.gradle 文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 25
buildToolsVersion "25.0.2"
defaultConfig {
applicationId "com.example.vbusovikov.glidetest"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
compile 'com.android.support:appcompat-v7:25.1.1'
compile 'com.github.bumptech.glide:glide:3.7.0'
testCompile 'junit:junit:4.12'
}
更新。这个简单的应用程序可以从互联网加载图片,但无法从我的服务器加载图片。我的一些服务器上的图片能够正常加载,但其他图片加载不出来。我已经迷失了方向。
Glide.with(yourclass.this)
- IntelliJ AmiyadontAnimate()
但是没有起作用。 - TrueCH