マイXMLコードピカソ、時々
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:id="@+id/ip_userpic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/whiteColor"
android:src="@drawable/buddy_menu_icon" />
<TextView
android:id="@+id/ip_name"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:text="@string/ip_name_placeholder" />
<Button
android:id="@+id/ip_follow"
style="@style/Widget.AppCompat.Button.Borderless.Colored"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@color/colorBackground"
android:contentDescription="@string/ip_follow_button"
android:text="@string/ip_follow_button" />
</LinearLayout>
このXMLはrecyclerviewに単一の行項目をロードします。 recyclerView.Adapterのコードは次の通り私のBuddyViewクラスのコードがある
@Override
public void onBindViewHolder(final BuddyView fellowBuddy, int position) {
---------------- * other code * -----
Uri uriBuddy = Uri.parse(buddyThis.getPhotoUrl());
Picasso.with(contextFRVA).setLoggingEnabled(true);//Todo: Debug profile photo random behaviour
Picasso.with(contextFRVA).load(uriBuddy).into(fellowBuddy.userPhoto);
---------------- * other code * -----
}
を下回っている:
class BuddyView extends RecyclerView.ViewHolder {
CircleImage userPhoto;
TextView userName;
String userID;
Button buttonFollow;
BuddyView (View itemView) {
super(itemView);
this.userPhoto = itemView.findViewById(R.id.ip_userpic);
this.userName = itemView.findViewById(R.id.ip_name);
this.buttonFollow = itemView.findViewById(R.id.ip_follow);
}
}
を今私はピカソのログをオンにしておりますので、それは以下のステートメントをログに記録されます
11-08 17:08:17.220 8701-8701/me.buddy.buddy D/Picasso: Main created [R1] Request{https://lh3.googleusercontent.com/-cNRNYVLKaPE/AAAAAAAAAAI/AAAAAAAAFLM/5KchSe2cA7Y/s96-c/photo.jpg}
11-08 17:08:17.220 8701-8962/me.buddy.buddy D/Picasso: Dispatcher enqueued [R1]+4ms
11-08 17:08:17.230 8701-9237/me.buddy.buddy D/Picasso: Hunter executing [R1]+5ms
11-08 17:08:17.240 8701-8701/me.buddy.buddy D/Picasso: Main created [R2] Request{https://lh3.googleusercontent.com/-cNRNYVLKaPE/AAAAAAAAAAI/AAAAAAAAFLM/5KchSe2cA7Y/s96-c/photo.jpg}
11-08 17:08:17.240 8701-8962/me.buddy.buddy D/Picasso: Hunter joined [R2]+1ms to [R1]+19ms, [R2]+1ms
11-08 17:08:17.240 8701-9237/me.buddy.buddy D/Picasso: Hunter decoded [R1]+20ms
11-08 17:08:17.240 8701-8962/me.buddy.buddy D/Picasso: Dispatcher batched [R1]+21ms, [R2]+4ms for completion
11-08 17:08:17.440 8701-8962/me.buddy.buddy D/Picasso: Dispatcher delivered [R1]+222ms, [R2]+205ms
11-08 17:08:17.460 8701-8701/me.buddy.buddy D/Picasso: Main completed [R1]+239ms from DISK
11-08 17:08:17.460 8701-8701/me.buddy.buddy D/Picasso: Main completed [R2]+223ms from DISK
すべてが順序であるように思わ、まだ写真はありません最初のインスタンスで、ImageViewのにロードされていません。しかし、私がその活動から遠ざかり、戻ってきたり、画面が消えて再び戻ってくると、イメージは適切な場所にあります。だから、いつでも活動が再開されているようだ、写真が表示されています。しかし、それは最初のインスタンス自体に読み込まれていません。
imageviewの "wrap_content"を固定幅に変更しようとしましたが、これと同じ動作です。
私は間違っていることを正確に把握することができません。誰もが上記のコードを見て、私が試すことができるいくつかの選択肢を提案するのに役立つことができますか?
多くの方に助けてください。あなたがここで見るとおり
あなたの画像を確認しましたか?uriは有効ですか?ピカソはイメージビューに束縛されません。 –
@HemantParmar - はい、有効なURIです。私がそれを読み込んだとき、私はアクティビティから離れて –