gpt4 book ai didi

Android Glide 错误 : cannot find symbol method crossFade()

转载 作者:太空宇宙 更新时间:2023-11-03 10:57:49 29 4
gpt4 key购买 nike

当我尝试显示来自 Gmail 帐户的图像时,我在 Glide 中遇到 cannot resolve symbol method crossFade() 错误。

private void handleSignInResult(GoogleSignInResult result) {
Log.d(TAG, "handleSignInResult:" + result.isSuccess());
if (result.isSuccess()) {
// Signed in successfully, show authenticated UI.
GoogleSignInAccount acct = result.getSignInAccount();

Log.e(TAG, "display name: " + acct.getDisplayName());

String personName = acct.getDisplayName();
if(acct.getPhotoUrl() != null){

personPhotoUrl = acct.getPhotoUrl().toString();
}
String email = acct.getEmail();

Log.e(TAG, "Name: " + personName + ", email: " + email + ", Image: " + personPhotoUrl);
txtName.setText(personName);
txtEmail.setText(email);
Glide.with(getApplicationContext()).load(personPhotoUrl).thumbnail(0.5f).crossFade().diskCacheStrategy(DiskCacheStrategy.ALL).into(imgProfilePic);


updateUI(true);
}
else {
// Signed out, show unauthenticated UI.
updateUI(false);
}
}

请注意,crossFade() 在我的 Android Studio 中显示为红色,如下图所示:

screenshot我尝试了 Stack Overflow 中的以下解决方案,但没有一个对我有用。

我怎样才能克服这个错误?

最佳答案

这有点旧,但如果其他人卡住了 Glide.with(getApplicationContext()).load(personPhotoUrl).thumbnail(0.5f).crossFade().diskCacheStrategy(DiskCacheStrategy.ALL).into(imgProfilePic);

改为

Glide.with(getApplicationContext()).load(personPhotoUrl).thumbnail(0.5f).transition(withCrossFade()).diskCacheStrategy(DiskCacheStrategy.ALL).into(imgProfilePic);

关于Android Glide 错误 : cannot find symbol method crossFade(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53570395/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com