【发布时间】:2014-08-13 06:38:24
【问题描述】:
我正在尝试使用PullToRefreshSwipeListView 自定义视图类在列表视图中同时使用PullToRefresh 和SwipeListView 库。我是这样实现的:
首先我将 PullToRefresh 库导入到我的项目中,然后通过在其中创建一个 libs 文件夹,将 SwipeListView Jar File 添加到 PullToRefresh 库项目中。然后我在 PullToRefresh 库项目的 src 文件夹(com.handmark.pulltorefresh.library)中添加了 PullToRefreshSwipeListView 类。最后,我尝试将这个自定义类 PullToRefreshSwipeListView 实现到我的项目的 xml 中:
<com.handmark.pulltorefresh.library.PullToRefreshListView
xmlns:swipe="http://schemas.android.com/apk/res-auto"
xmlns:ptr="http://schemas.android.com/apk/res-auto"
android:id="@+id/lv_Inbox"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:cacheColorHint="#00000000"
android:divider="#19000000"
android:dividerHeight="2dp"
android:fadingEdge="none"
android:fastScrollEnabled="false"
android:footerDividersEnabled="false"
android:headerDividersEnabled="false"
android:scrollbars="none"
android:smoothScrollbar="true"
ptr:ptrAnimationStyle="flip" >
<libs.swipelistview.SwipeListView
android:id="@+id/users_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:cacheColorHint="#0000"
android:clipToPadding="false"
android:divider="@null"
android:dividerHeight="0px"
android:fadingEdge="none"
android:scrollbarStyle="outsideOverlay"
swipe:swipeActionLeft="reveal" />
</com.handmark.pulltorefresh.library.PullToRefreshListView>
但我在 xml 中遇到错误:
- 错误:在包中找不到属性“swipeActionLeft”的资源标识符
- 错误:在包中找不到属性“swipeActionLeft”的资源标识符
- 错误:在包中找不到属性“swipeMode”的资源标识符
它没有获得任何滑动属性,但如果我删除滑动属性。它仅适用于 PullToRefresh。我正在关注this 链接来实现它。任何解决方案/意见将不胜感激。
【问题讨论】:
-
不需要使用外部库。您本机使用滑动刷新布局和 android 滑动列表项。 developer.android.com/reference/android/support/v4/widget/… 和滑动示例 stackoverflow.com/questions/17857775/…
-
不,您不能将 SwipeRefreshLayout 与 PullToRefresh 进行比较。 Android 支持库类 SwipeRefreshLayout 不提供添加操作栏提示“拉动刷新”的方法。
-
你有完美的答案吗?我也有同样的问题。我没有得到任何适当的解决方案...我该怎么做?
标签: android android-listview pull-to-refresh swipeview