您好,我正在嘗試在我的應用程式中添加個人資料影像,但它沒有顯示影像我收到此錯誤我還嘗試在用戶配接器中添加它也沒有顯示我無法解決問題感謝您的回答謝謝
錯誤資訊
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"/>
uj5u.com熱心網友回復:
我試圖從我從您的日志中提取的鏈接中打開資源,gs://travelinstam2.appspot.com/placeholder.png但它失敗了。
您是否檢查過資源 URL 是否正確且可訪問?
答:根據我們在評論部分的討論,問題在于提供給 Glide 的 URL。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/423134.html
標籤:
