Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/180.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
QuiltView Gallery在Android中具有刷新功能?_Android_Pull To Refresh_Quiltview - Fatal编程技术网

QuiltView Gallery在Android中具有刷新功能?

QuiltView Gallery在Android中具有刷新功能?,android,pull-to-refresh,quiltview,Android,Pull To Refresh,Quiltview,我正在android上开发一个社交网络应用程序,当时我正在使用QuiltView-Library制作一个QuiltView图像库 在同一个应用程序中,我使用了手工绘制来刷新GridView的库 两者都很好。现在,我必须为组合任务实现这两个库,即在QuiltView GALLERY中拉入刷新 我遇到的问题是将两个完全不同的库的XML结合起来 带简单网格视图的PullToRefresh的XML: QuiltView图库的XML: <FrameLayout xmlns:android="

我正在android上开发一个社交网络应用程序,当时我正在使用QuiltView-Library制作一个QuiltView图像库

在同一个应用程序中,我使用了手工绘制来刷新GridView的库

两者都很好。现在,我必须为组合任务实现这两个库,即在QuiltView GALLERY中拉入刷新

我遇到的问题是将两个完全不同的库的XML结合起来

带简单网格视图的PullToRefresh的XML:


QuiltView图库的XML:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:quilt="http://schemas.android.com/apk/res/com.tv.photos"
    android:id="@+id/FrameLayout1"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white" >

    <com.tv.photos.QuiltView
        android:id="@+id/quilt"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="5dip" >
    </com.tv.photos.QuiltView>

</FrameLayout>

如果有人能给我建议,请告诉我。

这很简单:

  • Chris Banes的pulltorfresh库支持
    ScrollView
  • QuiltView库只是一个
    GridLayout
    的扩展(不是GridView或任何其他适配器类)
QuiltView
的实例放在
PullToRefreshScrollView
的实例中。例如

不应该比这更复杂:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <com.handmark.pulltorefresh.library.PullToRefreshScrollView
        xmlns:ptr="http://schemas.android.com/apk/res-auto"
        android:id="@+id/pull_refresh_scrollview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <com.tv.photos.QuiltView
            android:id="@+id/quilt"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:padding="5dip" />

    </com.handmark.pulltorefresh.library.PullToRefreshScrollView>

</LinearLayout>

您可以继续使用Handerk的pulltorefresh库,并创建一个pulltorefresh视图,该视图与其中的quiltview一起工作。 由于QuiltView扩展了FrameLayout,您无法在handmark的pull to refresh中直接使用它,但您面前有3个选项:

1。通过扩展PullToRefreshBase类创建PullToRefreshQuitView的新类。

只需创建一个扩展PullToRefreshBase的类 您可以查看PullToRefreshWebView类来了解如何做到这一点

2。在QuiltView的设置功能中使用滚动视图

您可以将设置功能中的scrollview更改为pullToRefreshScrollView,或将此scrollview添加到ptr视图中

3。在Handmark的PullToRefresh或android SwipeRefreshLayout中使用RecyclerView和GridLayoutManager

另一种选择是在handmark的pulltorefresh或android的SwiperRefresh布局中使用带有GridLayoutManager(类似的东西)的RecyclerView

有关SwipeRefreshLayout的更多信息,请查看android文档

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <com.handmark.pulltorefresh.library.PullToRefreshScrollView
        xmlns:ptr="http://schemas.android.com/apk/res-auto"
        android:id="@+id/pull_refresh_scrollview"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <com.tv.photos.QuiltView
            android:id="@+id/quilt"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:padding="5dip" />

    </com.handmark.pulltorefresh.library.PullToRefreshScrollView>

</LinearLayout>