我正在使用AndroidQuery处理图像的方式,然后保存到SD卡。但由于某种原因,对话框未显示。图像正确保存在SD卡中,只有对话框是问题所在。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="100dip"
>
<ProgressBar
android:layout_width="15dip"
android:layout_height="15dip"
android:id="@+id/progress"
android:layout_centerInParent="true"
/>
<ImageView
android:id="@+id/image"
android:layout_width="fill_parent"
android:layout_height="75dip"
/>
</RelativeLayout>
法典:
String url = path;
File ext = Environment.getExternalStorageDirectory();
File target = new File(ext, "Folder/Folder/" + pathName + ".jpg");
laQuery.progress(R.id.progress).download(url, target, new AjaxCallback<File>() {
public void callback(String url, File file, AjaxStatus status) {
if (file != null) {
// Log.d("File:" + file.length() + ":" + file, status);
Log.i("Aquery not null", "File:" + file.length());
Log.i("Aquery not null", "File:" + file);
Log.i("Aquery not null", "File:" + status);
} else {
Log.d("Failed", "" + status);
}
}
});
RelativeLayout
子项按声明顺序绘制。因此,您的ProgressBar
位于ImageView
下方,Android Query 没有对ImageView
的引用来控制其可见性。
切换其声明的顺序,使进度条位于顶部。
更新:已检查源,download()
请求不支持进度条,只有image()
请求支持进度条。您必须将进度条设置为自己可见并将其隐藏在 callback()
中。