Phonegap:android中图像加载速度非常慢
我正在使用phonegap和ionic在android中创建一个应用程序,从SD卡检索图像并显示。因此,我能够检索所有图像,但显示这些图像需要更多的时间。滚动速度也非常慢,任何事情发生都需要一秒钟以上的时间。我正在使用collection-repeat显示这些图像。这是我的代码:Phonegap:android中图像加载速度非常慢,android,cordova,Android,Cordova,我正在使用phonegap和ionic在android中创建一个应用程序,从SD卡检索图像并显示。因此,我能够检索所有图像,但显示这些图像需要更多的时间。滚动速度也非常慢,任何事情发生都需要一秒钟以上的时间。我正在使用collection-repeat显示这些图像。这是我的代码: function onDeviceReady() { window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail); } funct
function onDeviceReady() {
window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fail);
}
function gotFS(fileSystem) {
window.fileSystem = fileSystem;
fileSystem.root.getDirectory("", {
create: false,
exclusive: false
}, getsubdirectry, onError);
}
function getsubdirectry(dirEntry, onComplete) {
try {
var directoryReader = dirEntry.createReader();
} catch (e) {
alert(e);
}
directoryReader.readEntries(function(entries) {
for (i = 0; i < entries.length; i++) {
if (entries[i].name.indexOf(".jpg") == -1) {
if (entries[i].isDirectory) {
entries[i].getDirectory("", {
create: false,
exclusive: false
}, getsubdirectry, onError);
}
} else {
imagedetails.push({
id: i,
url: entries[i].toURI(),
tag: ""
});
}
}
onComplete();
}, function(error) {
alert("Error: = " + error.code);
});
}
函数ondevicerady(){
requestFileSystem(LocalFileSystem.PERSISTENT,0,gotFS,fail);
}
函数gotFS(文件系统){
window.fileSystem=文件系统;
fileSystem.root.getDirectory(“{
创建:false,
独家:假
},getsubdirectry,onError);
}
函数getsubdirectry(dirEntry,onComplete){
试一试{
var directoryReader=dirEntry.createReader();
}捕获(e){
警报(e);
}
directoryReader.readEntries(函数(条目){
对于(i=0;i
在html中
<a href="#/tab/photo/{{friend.id}}" class="gallery-item" collection-repeat="friend in outputphotos | myFilter:text track by $index" collection-item-width="'33%'"
collection-item-height="'33%'">
<img ng-src="{{friend.url}}" id="imageviewmainpage">
</a>
那么,我应该添加哪些更改来加快加载速度,或者还有其他方法吗?我保存了代码,以便在检索照片时(而不是在检索完整图像后)显示照片。ie当iam在imagedetails数组中聚集图像时,iam将其显示在网络步骤中。所以现在照片加载更好了。但是点击仍然需要一些时间,有什么建议吗????