1

PullToRefreshSwipeListViewカスタム ビュー クラスを使用して、リストビューでPullToRefreshライブラリとSwipeListViewライブラリの両方を使用しようとしています 。私はそれを次のように実装しました:

まず、PullToRefresh ライブラリをプロジェクトにインポート してから、libs フォルダーを作成してSwipeListView Jar ファイルを 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 のみで正常に動作しています。このリンクをたどって実装しています。解決策/コメントは大歓迎です。

4

2 に答える 2

1

PullToRefresh を SwipeListView ライブラリにマージしようとしているのはなぜですか? 問題なくSwipeListViewでPullToRefreshを使用しました(JARではなくgradleを使用してインポートしただけです)。

SwipeListView ライブラリ (このファイル)のres/valuesからswipelistview__attrs.xmlをコピーしていないため、これらのエラーが発生しています。

于 2014-08-26T10:15:05.860 に答える
1
better you go with 
swiperefresh layout

https://developer.android.com/reference/android/support/v4/widget/SwipeRefreshLayout.html
于 2014-08-13T06:56:26.637 に答える