所以我想在加载图片的网格视图时向用户提供一些反馈。下面是我的适配器UI。我有一个非常讨厌的方法来完成我的任务,为gridview的每个元素添加一个微调器。当NetworkImageView加载时,它会隐藏微调器..
然而我问自己,我想使用或向任何人展示这个吗?没办法,除了成为一个黑客之外,拥有8个以上的旋转器对于性能来说是可怕的。
我一直在研究它......我看到有一些copyNpaste是一个自定义版本的NetworkImageViewer代码,它允许我放一个观察者,但这似乎是强烈/过度的。
我还尝试将回调放入截击ImageLoader中的get / set图像,以在访问数据时关闭微调器。它已经完成了一半,但也认为解决方案太难看了。
除了手动执行正常的截击请求并且必须手动处理图像并将其放在凌空成功监听器上之外...我很难过。有人知道这里有干净的解决方案吗?我猜我必须手动做..
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="@dimen/image_size"
android:paddingBottom="@dimen/element_spacing"
android:paddingTop="@dimen/element_spacing">
<ImageView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_margin="@dimen/element_spacing"
android:background="@color/color_primary"
android:gravity="center_vertical" />
<ProgressBar
android:id="@+id/grid_adapter_spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
<com.android.volley.toolbox.NetworkImageView
android:id="@+id/gridview_adapter_networkimageview"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/element_spacing"
android:background="@color/color_primary"
android:layout_centerInParent="true"
/>
</RelativeLayout>