我已经创建了自己的listmodel并覆盖了它的方法,图像显示在android中,但是在iphone中它首次显示图像,当返回并返回页面时它只显示白屏,如何解决?
@Override
public Image getItemAt(final int index) {
if (images[index] == null) {
String imageName = "image_" + urls.get(index).hashCode();
if (Storage.getInstance().exists(imageName)) {
InputStream is;
try {
is = Storage.getInstance().createInputStream(imageName);
EncodedImage i = EncodedImage.create(is, is.available());
images[index] = i;
} catch (IOException ex) {
ex.printStackTrace();
}
} else {
images[index] = defaultImage;
Util.downloadUrlToStorageInBackground(urls.get(index), imageName, (e) -> {
try {
images[index] = EncodedImage.create(Storage.getInstance().createInputStream(imageName));
listeners.fireDataChangeEvent(index, DataChangedListener.CHANGED);
} catch (IOException err) {
err.printStackTrace();
}
});
}
}
return images[index];
}
答案 0 :(得分:0)
您似乎返回//HTML
<div ng-model="len">
<h2 id="timednum">
<span>{{ len }}</span>
</h2>
</div>
//js
var firebaseRef = new Firebase("https://myApp.firebaseio.com/data");
firebaseRef.on('value', function(dataSnapshot){
var tableLength = dataSnapshot.val().data;
$scope.len = tableLength;
$scope.$apply(); //SOLUTION!!!!
console.log("this updates properly" + $scope.len);
})
});
表示可能存在问题的丢失图像。您需要返回占位符值并在以后替换它们。