-2
在我的viewpager的一個頁面中,有3個圖像來自後端。但只有第一個圖像是加載剩餘的圖像不加載。我在onstart裏調試圖像名稱圖像名稱進入Android監視器。只有單個圖像在viewpager中加載
我imagefragment 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="match_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/imgfragment_imageview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:src="@mipmap/ic_launcher"
android:background="#000000" />
</LinearLayout>
而且相應的Java文件看起來像下面
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import java.io.File;
import in.creace.magdreams.MagdreamsApplication;
import in.creace.magdreams.R;
public class ImageFragment extends Fragment{
private View mView;
private ImageView image;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mView=inflater.inflate(R.layout.layout_imagefragment, null);
return mView;
}
@Override
public void onStart() {
String path=getArguments().getString("IMAGEPATH");
image=(ImageView) mView.findViewById(R.id.imgfragment_imageview);
File file = new File(path);
MagdreamsApplication.getInstance().getAquery().id(image).image(file,400);
super.onStart();
}
}
請通過我的代碼。我在這段代碼中犯了什麼錯誤?如果代碼有任何錯誤,請糾正它
什麼是MagdreamsApplication,它在幹什麼? –
這是一個公開課,只是爲aquery提供實例...我也用滑翔來代替,但同樣的問題發生了 –
這個API不太理解。但是我可以看到 - 你只加載一張圖片。那麼其他人怎麼可能被抓? –