2017-03-01 60 views
0

我封裝了android原生UI組件,並將其與我的反應原生應用程序集成。佈局是這樣的。當第一次打開react-native頁面時,圖像不會在Fresco的SimpleDraweeView中顯示

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:fresco="http://schemas.android.com/apk/res-auto" 
android:layout_width="42dp" 
android:layout_height="42dp" 
android:background="@drawable/location_bubble"> 

<com.facebook.drawee.view.SimpleDraweeView 
    android:id="@+id/avatar_image" 
    android:layout_width="26dp" 
    android:layout_height="26dp" 
    android:layout_marginTop="6dp" 
    android:layout_centerHorizontal="true" 
    android:scaleType="centerCrop" 
    fresco:failureImageScaleType="fitCenter" 
    fresco:placeholderImage="@drawable/gift_box_0" 
    fresco:placeholderImageScaleType="centerCrop" 
    fresco:roundAsCircle="true" /> 
</RelativeLayout> 

我在代碼中設置SimpleDraweeView的imageUri動態:

SimpleDraweeView avatar = (SimpleDraweeView)infoWindow.findViewById(R.id.avatar_image); avatar.setImageURI(UserRepository.getInstance().getUserInfo().getAvatar().getUrl());

然而,當我第一次打開頁面的反應,它只能顯示圖像佔位符。如果我回到上一頁,然後再次輸入此反應頁面,則付款人顯示正確的圖像。那麼我應該怎麼做才能解決這個問題呢?謝謝!

+0

的解決方案可以參考[這個問題](https://github.com/facebook/fresco/issues/1683)。 – Elyon

回答

相關問題