标签: android-glide

Android,使用带有Glide库的BitmapPool

我在我的应用程序中使用滑动库来显示位图(来自资产和来自url).它运作良好,但我得到了回忆问题因为我在每个活动中显示了很多图像.我看到我可以使用BitmapPool中的clearMemory(),但我不知道如何调用它.

有人知道怎么称呼它吗?

谢谢

android bitmap android-glide

2
推荐指数
1
解决办法
4401
查看次数

如何在Android的Glide中显示数据库图像?

SqliteDatabase我的申请中有一个。在此数据库中,我保存了StingBlob(用于保存图像)。该图像使用byte []保存在应用程序中。我借助以下代码将该图像转换为Bitmap:

    byte[] Recycler_imageByte;
    Bitmap Recycler_theImage;

holder.Recycler_imageByte = data.get(position).getKey_image();
ByteArrayInputStream imageStream = new ByteArrayInputStream(holder.Recycler_imageByte);
holder.Recycler_theImage = BitmapFactory.decodeStream(imageStream);
Run Code Online (Sandbox Code Playgroud)

我想在Glidelibary中显示此图像,我编写了以下代码:

Glide.with(context).load(holder.Recycler_theImage).asBitmap().into(holder.Recycler_adapter_image);
Run Code Online (Sandbox Code Playgroud)

但是,当我运行应用程序时,显示以下错误:

03-15 10:23:14.311 22440-22440/com.tellfa.dastanak E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.tellfa.dastanak, PID: 22440
java.lang.IllegalArgumentException: Unknown type class android.graphics.Bitmap. You must provide a Model of a type for which there is a registered ModelLoader, if you are using a custom model, you must first call Glide#register with a ModelLoaderFactory for your custom model class …
Run Code Online (Sandbox Code Playgroud)

android bitmap android-bitmap android-glide

2
推荐指数
1
解决办法
2599
查看次数

Android Glide下载前显示

我正在使用Glide,我想知道是否可以下载所有图像而不显示它们以填充缓存以便稍后显示它们?我尝试了这个,但没有下载图像:

for (String url: urls) {
    Glide.with(getBaseContext()).load(url);
    Log.v("Download", "processing");
}
Run Code Online (Sandbox Code Playgroud)

你能帮助我吗 ?

android image download android-glide

2
推荐指数
1
解决办法
5016
查看次数

使用Glide和okhttp3在Stetho中进行网络检查

如何结合Glide和Stetho使用okhttp3调试图像加载系统

我做了以下

1.增加了依赖性

//stetho
compile 'com.facebook.stetho:stetho:1.3.1'
compile 'com.facebook.stetho:stetho-okhttp3:1.3.1'
//glide
compile 'com.github.bumptech.glide:glide:3.7.0'
// Glide's OkHttp3 Integration
compile 'com.github.bumptech.glide:okhttp3-integration:1.4.0@aar'
//okhttp3
compile 'com.squareup.okhttp3:okhttp:3.2.0'
Run Code Online (Sandbox Code Playgroud)

1.增加了初始化

public class MyApplication extends Application {

@Override
public void onCreate() {
    super.onCreate();

    Stetho.initialize(
            Stetho.newInitializerBuilder(this)
                    .enableDumpapp(Stetho.defaultDumperPluginsProvider(this))
                    .enableWebKitInspector(Stetho.defaultInspectorModulesProvider(this))
                    .build());
    }
}
Run Code Online (Sandbox Code Playgroud)

3.add glide config使用okhttp3

/**
 * Created by Arnaud Camus Copied by MOMANI on 2016/04/15.
 * http://arnaud-camus.fr/combining-glide-and-stetho-to-easily-debug-your-image-loading-system/
 */
public class StethoOkHttpGlideModule  implements GlideModule {
    @Override
    public void applyOptions(Context context, GlideBuilder builder) { }

    @Override
    public void registerComponents(Context context, Glide glide) { …
Run Code Online (Sandbox Code Playgroud)

debugging android android-glide stetho okhttp3

2
推荐指数
1
解决办法
2546
查看次数

Android Glide和Volley:无法显示存储在Firebase存储中的图像

我知道解决方案存在于人们说使用GlidePicasso等图像缓存工具的地方,你可以显示图像.但我尝试过同样的事情,但是不行.

以下是我将文件上传到Firebase存储的实现

 if (uri != null) {
        //upload to storage
        StorageReference riversRef = imagesRef.child(uri.getLastPathSegment());
        UploadTask uploadTask = riversRef.putFile(uri);
        // Register observers to listen for when the download is done or if it fails
        uploadTask.addOnFailureListener(new OnFailureListener() {
            @Override
            public void onFailure(@NonNull Exception exception) {
                // Handle unsuccessful uploads
                Snackbar.make(coordinatorLayout, "Unable to process your request. Please try again.", Snackbar.LENGTH_SHORT).show();
            }
        }).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
            @Override
            public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
                // taskSnapshot.getMetadata() contains file metadata such as size, content-type, …
Run Code Online (Sandbox Code Playgroud)

android firebase android-volley android-glide firebase-storage

2
推荐指数
1
解决办法
3274
查看次数

使用滑动库的图像灰度

我正在使用滑动库在图像视图中加载图像网址.

Glide.with(context)
                .load(imageurl)
                .apply(RequestOptions.circleCropTransform())
                .into(holder.thumbnail);
Run Code Online (Sandbox Code Playgroud)

实际上,图像加载得很好,带有圆形图像.

我需要加载圆形+ 灰度图像的图像

这可以通过使用滑翔lib来完成吗?

android android-imageview android-glide

2
推荐指数
1
解决办法
2169
查看次数

Android Studio 3.1,没有用于离线模式的缓存版本

自从升级到Android Studio 3.1以来,我遇到了一个大问题:

No cached version of com.github.bumptech.glide:compiler:4.6.1 available for offline mode
Run Code Online (Sandbox Code Playgroud)

但是我不处于离线模式,您可以在此处看到:

在此处输入图片说明

我尝试了“清理项目”和“重建项目”,但都没有成功。我什至重启了我的电脑。

这是我的Build.gradle:

dependencies {
    implementation fileTree(include: ['*.jar'], dir: 'libs')
    implementation 'com.android.support:design:27.1.0'
    implementation 'com.android.support:support-v4:27.1.0'
    implementation 'com.android.support:appcompat-v7:27.1.0'
    implementation "com.android.support:gridlayout-v7:27.1.0"
    implementation 'com.android.support:exifinterface:27.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    implementation 'com.google.code.gson:gson:2.8.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'
    implementation 'com.github.bumptech.glide:glide:4.6.1'
    annotationProcessor 'com.github.bumptech.glide:compiler:4.6.1'
}
Run Code Online (Sandbox Code Playgroud)

android offline gradle android-studio android-glide

2
推荐指数
1
解决办法
8651
查看次数

Android - Glide".placeholder"方法无法识别

我有一个回收者的观点.在适配器的onBindViewHolder方法中,我有以下代码来加载图像:

override fun onBindViewHolder(holder: ViewHolder, position: Int) {
        Log.i("TEST-APP", "Binding View Holder")

        Glide.with(context)
                .load(items[position])
                .placeholder(R.drawable.animated_loading_icon)
                .into(holder.imageView)
    }
Run Code Online (Sandbox Code Playgroud)

但是,Android Studio称"占位符"是一个未解决的参考.这很令人困惑,因为文档表明这是加载占位符的正确方法.

我究竟做错了什么?

另外,这是我在RecyclerViewAdapter课堂上的进口

package com.example.myname.recylerviewtest

import android.content.Context
import android.support.v7.widget.RecyclerView
import android.util.Log
import android.view.*
import com.bumptech.glide.Glide
import kotlinx.android.synthetic.main.recyclerview_item_column.view.*
Run Code Online (Sandbox Code Playgroud)

最后,这是我在build.gradle中的依赖项:

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'com.android.support:appcompat-v7:27.1.1'
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
api 'com.android.support:recyclerview-v7:27.1.1'
implementation 'com.android.support:support-v4:27.1.1'
implementation 'me.zhanghai.android.materialprogressbar:library:1.4.2'
implementation 'com.github.bumptech.glide:glide:4.7.1'
annotationProcessor 'com.github.bumptech.glide:compiler:4.7.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
}
Run Code Online (Sandbox Code Playgroud)

kotlin android-glide

2
推荐指数
1
解决办法
1599
查看次数

如何在Android Studio中通过Glide在标头中添加授权?

我正在使用Glide版本= 4.7.1

我不知道如何通过滑行认证图像。这段代码就是我所做的。

我建立:

 private static final String AUTHORIZATION = "ss-id=doa3cx8OV3aGLThRrpnh;";
private static final String ABC = "application/json";

public static GlideUrl getUrlWithHeaders(String url){
    return new GlideUrl(url, new LazyHeaders.Builder()
            .addHeader("Cookie", AUTHORIZATION)
            .addHeader("Accept", ABC)
            .build());
}
Run Code Online (Sandbox Code Playgroud)

}

String s = "http://192.168.1.144/api/download/" + mImageIds.get(position);
        GlideApp
                .with(mContext)
                .load(Headers.getUrlWithHeaders(s))
                .centerCrop()
                .transition(DrawableTransitionOptions.withCrossFade())
                .into((imageView));
Run Code Online (Sandbox Code Playgroud)

任何帮助,

android android-glide

2
推荐指数
2
解决办法
1637
查看次数

错误:包com.bumptech.glide.request.animation不存在

我在以下软件包中添加了应用gradle软件包:

implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:glide:4.8.0'
Run Code Online (Sandbox Code Playgroud)

但是在运行时出现以下错误:

错误:包com.bumptech.glide.request.animation不存在

有人面对这样吗?

android android-glide

2
推荐指数
1
解决办法
2805
查看次数