滑动不显示图像
Glide not showing the Image
您好,我正在尝试在我的应用程序中添加个人资料图片,但它没有显示图像我收到此错误我还尝试添加用户适配器它也没有显示我无法解决问题感谢您的回答谢谢
错误信息
2022-01-28 08:32:18.553 28556-28556/com.example.travelinstam I/ViewTarget: Glide treats LayoutParams.WRAP_CONTENT as a request for an image the size of this device's screen dimensions. If you want to load the original image and are ok with the corresponding memory cost and OOMs (depending on the input size), use .override(Target.SIZE_ORIGINAL). Otherwise, use LayoutParams.MATCH_PARENT, set layout_width and layout_height to fixed dimension, or use .override() with fixed dimensions.
2022-01-28 08:32:18.568 28556-28556/com.example.travelinstam I/ViewTarget: Glide treats LayoutParams.WRAP_CONTENT as a request for an image the size of this device's screen dimensions. If you want to load the original image and are ok with the corresponding memory cost and OOMs (depending on the input size), use .override(Target.SIZE_ORIGINAL). Otherwise, use LayoutParams.MATCH_PARENT, set layout_width and layout_height to fixed dimension, or use .override() with fixed dimensions.
2022-01-28 08:32:18.742 28556-28556/com.example.travelinstam W/Glide: Load failed for gs://travelinstam2.appspot.com/placeholder.png with size [100x100]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
2022-01-28 08:32:18.785 28556-28556/com.example.travelinstam W/Glide: Load failed for gs://travelinstam2.appspot.com/placeholder.png with size [100x100]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
这是我的代码
private void userInfo(){
DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Users").child(profileid);
reference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if (getContext() == null){
return;
}
User user = dataSnapshot.getValue(User.class);
Glide.with(getContext()).load(user.getImageurl()).into(image_profile);
username.setText(user.getUsername());
fullname.setText(user.getFullname());
bio.setText(user.getBio());
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
我用的是hdodenhof:circleimageview版本
implementation 'de.hdodenhof:circleimageview:3.1.0'
这是我的布局代码
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/image_profile"/>
我试图打开从您的日志 gs://travelinstam2.appspot.com/placeholder.png
中提取的 link 中的资源,但失败了。
您是否检查过资源 URL 是否正确且可访问?
回答:根据我们在评论区的讨论,问题出在提供给Glide的URL上。
您好,我正在尝试在我的应用程序中添加个人资料图片,但它没有显示图像我收到此错误我还尝试添加用户适配器它也没有显示我无法解决问题感谢您的回答谢谢
错误信息
2022-01-28 08:32:18.553 28556-28556/com.example.travelinstam I/ViewTarget: Glide treats LayoutParams.WRAP_CONTENT as a request for an image the size of this device's screen dimensions. If you want to load the original image and are ok with the corresponding memory cost and OOMs (depending on the input size), use .override(Target.SIZE_ORIGINAL). Otherwise, use LayoutParams.MATCH_PARENT, set layout_width and layout_height to fixed dimension, or use .override() with fixed dimensions.
2022-01-28 08:32:18.568 28556-28556/com.example.travelinstam I/ViewTarget: Glide treats LayoutParams.WRAP_CONTENT as a request for an image the size of this device's screen dimensions. If you want to load the original image and are ok with the corresponding memory cost and OOMs (depending on the input size), use .override(Target.SIZE_ORIGINAL). Otherwise, use LayoutParams.MATCH_PARENT, set layout_width and layout_height to fixed dimension, or use .override() with fixed dimensions.
2022-01-28 08:32:18.742 28556-28556/com.example.travelinstam W/Glide: Load failed for gs://travelinstam2.appspot.com/placeholder.png with size [100x100]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
2022-01-28 08:32:18.785 28556-28556/com.example.travelinstam W/Glide: Load failed for gs://travelinstam2.appspot.com/placeholder.png with size [100x100]
class com.bumptech.glide.load.engine.GlideException: Failed to load resource
这是我的代码
private void userInfo(){
DatabaseReference reference = FirebaseDatabase.getInstance().getReference("Users").child(profileid);
reference.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(@NonNull DataSnapshot dataSnapshot) {
if (getContext() == null){
return;
}
User user = dataSnapshot.getValue(User.class);
Glide.with(getContext()).load(user.getImageurl()).into(image_profile);
username.setText(user.getUsername());
fullname.setText(user.getFullname());
bio.setText(user.getBio());
}
@Override
public void onCancelled(@NonNull DatabaseError databaseError) {
}
});
}
我用的是hdodenhof:circleimageview版本
implementation 'de.hdodenhof:circleimageview:3.1.0'
这是我的布局代码
<de.hdodenhof.circleimageview.CircleImageView
android:layout_width="80dp"
android:layout_height="80dp"
android:id="@+id/image_profile"/>
我试图打开从您的日志 gs://travelinstam2.appspot.com/placeholder.png
中提取的 link 中的资源,但失败了。
您是否检查过资源 URL 是否正确且可访问?
回答:根据我们在评论区的讨论,问题出在提供给Glide的URL上。