如何设置带有滑行文字的背景图片?
file[0] = "mnt/sdcard/sort_icon.png"
SimpleTarget target = new SimpleTarget<Drawable>(){
@Override
public void onResourceReady(Drawable resource, GlideAnimation<? super Drawable> glideAnimation) {
txtView.setBackground(resource);
}
};
Glide.with(getBaseContext())
.load(file[i-4])
.into(target);
答案 0 :(得分:0)
解决方案:
尝试一下:
在您的gradle
(应用程序)中添加实现:
dependencies {
.....
.....
def glide = "4.8.0"
// Glide
implementation "com.github.bumptech.glide:glide:$glide"
annotationProcessor "com.github.bumptech.glide:compiler:$glide"
.....
}
然后,在您的Activity/Fragment
中:
File file = new File(file[i-4]);
Uri imageURI = Uri.fromFile(file);
Glide.with(MainActivity.this)
.load(imageURI)
.apply(RequestOptions.placeholderOf(R.drawable.ic_launcher))
.into(new SimpleTarget<Drawable>() {
@Override
public void onResourceReady(@NonNull Drawable resource,
@Nullable Transition<? super Drawable> transition) {
txtView.setCompoundDrawablesWithIntrinsicBounds(resource, null, null, null);
}
});
看看是否可行。