实现47度android-swipelistview来滑动android ListViewItem [英] Implementing 47degree android-swipelistview for swiping android ListViewItem

查看:82
本文介绍了实现47度android-swipelistview来滑动android ListViewItem的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上,我的目标是在android中实现ListViewItem Swipe.我已经尝试过了,stackoverflow有几个可以使您的ListViewSwipe的示例.例子.

Actually my goal is to implement a ListViewItem Swipe in android. I have tried it and stackoverflow has several examples which can make your ListViewSwipe. Examples.

简单滑动手势即可进行活动的教程?

显示按钮滑动列表中的一项的列表视图

有一点是,每个人都没有给出代码来解释正在发生的事情.

然后我问了这个问题 Android列表视图Right/像通话记录一样向左滑动,在其上@CommonsWare已通过SwipeListView库进行了应答,该库具有顺畅的流程,然后是可接受的答案.可接受的答案也很好,我目前仅使用它.

Then I asked question for it Android list view Right / Left swipes like call logs on which @CommonsWare have answered with SwipeListView library which has a smooth flow then the accepted answer. The accepted answer is also working fine I am presently using that only.

这是库 http://www.androidviews.net/2013/03/swipelistview/ 这样可以为您提供这样的列表视图

This is the library http://www.androidviews.net/2013/03/swipelistview/ Which provides you listview like this

我已经尝试了50次以上,以运行github此处提供的示例应用程序 https://github.com/47deg/android-swipelistview-sample 但每次我遇到新问题时.目前即将到来的异常是

I have tried more then 50 times to run the sample application provided on github here https://github.com/47deg/android-swipelistview-sample But everytime I am facing new problems. Presently the exception which is coming is

05-22 15:35:19.392: E/AndroidRuntime(980): Caused by: java.lang.ClassNotFoundException: Didn't find class "com.fortysevendeg.android.swipelistview.SwipeListView" on path: /data/app/com.fortysevendeg.android.swipelistview-2.apk

我不知道发生了什么,我已经检查了构建路径,还包括库,在stackoverflow聊天中问了很多人,但是没有任何帮助.

I don't know what is happening I have checked the buildpath, libraries are also included asked so many people on stackoverflow chat But haven't got any help.

实际上,在互联网上,我没有问过这么多人如何实现它的单个教程.因此,我想知道是否有人使用过该库,请写一个适当的答案.如何预先使用它.因此,与我一起的其他未来读者也可以从中受益.

Actually on internet there is not a single tutorial for its implementation I have asked to so many peoples. So I want to know if someone have used this library please write an appropriate answer How to use it preporly So with me other future readers can also take the benefit out of it.

或者还有其他库可以执行以实现这种功能.

Or is there any other library to perform to implement this kind of functionality.

如@CommonsWare所建议.我已经给作者写了一封电子邮件,还写了使用它的教程.

推荐答案

最后,我设法将47%的Android-SwipeListView库集成到我自己的应用程序中.

像魅力一样工作.感谢47Degrees编写了如此精彩的代码.

Works like a charm. Thanks to 47Degrees for writing such a wonderful piece of code.

解决方案:

什么不起作用?!

What doesn't work?!

在项目/值中包含JAR作为依赖项和attrs.xml或在项目中将SwipeListView库作为lib依赖项引用都无效.

Including JAR as dependency and attrs.xml in res/values OR referencing the SwipeListView library as a lib dependency in your project does not work.

什么有效?!

What works?!

在您的应用程序包中包括以下类.确保将这些类中的软件包名称更正为您的软件包名称

Include following classes in your application package. Be sure to correct the package names in these classes to your package name

  • SwipeListView.java
  • SwipeListViewListener.java
  • SwipeListViewListenerBase.java
  • SwipeListViewTouchListener.java

在应用程序res/values文件夹中包含以下xml

  • attrs.xml

现在,您可以按以下方式定义和使用SwipeListView

<au.com.your.package.SwipeListView
        xmlns:swipe="http://schemas.android.com/apk/res-auto"
        android:id="@+id/swipe_listview"
        android:listSelector="#00000000"
        android:layout_width="match_parent"
        android:layout_height="match_parent"        
        swipe:swipeFrontView="@+id/front"
        swipe:swipeBackView="@+id/back"
        swipe:swipeActionLeft="reveal"
        swipe:swipeActionRight="choice"
        swipe:swipeMode="both"
        swipe:swipeCloseAllItemsWhenMoveList="true"
        swipe:swipeOpenOnLongPress="true"
        swipe:swipeAnimationTime="100"
        swipe:swipeOffsetLeft="50dp"
        swipe:swipeDrawableChecked="@drawable/item_selected"
        swipe:swipeDrawableUnchecked="@drawable/item_unselected"
   />

活动代码,您可以使用

Activity code you can use same as displayed in the example on SwipeListView github site.

您需要从上面的代码中更正一些导入.此外,您还需要将 Jake Wharton的NineOldAndroids 作为lib依赖项包含在项目中.

You will need to correct some imports from the code above. In addition, you'll need to have NineOldAndroids by Jake Wharton included as a lib dependency in your project.

这篇关于实现47度android-swipelistview来滑动android ListViewItem的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆