【问题标题】:Is there onListItemTouch method in listviewlistview中是否有onListItemTouch方法
【发布时间】:2012-04-02 11:39:19
【问题描述】:

我知道 onListItemClick 方法来处理点击监听器如下。

protected void onListItemClick(ListView l, View v, int position, long id){
}

但是如果我想处理触摸监听器。 当项目被触摸时,我想获得位置。 但在onListItemClick 中不做。 我该如何在 ListView 中进行操作? 上面有这样的方法吗?

【问题讨论】:

    标签: android listview


    【解决方案1】:

    你需要调用onInterceptTouchEvent()方法

    请查看我的回答here

    【讨论】:

      【解决方案2】:

      使用AbsListView.onTouchEvent()

      您必须继承 ListView 才能使用它。

      http://developer.android.com/reference/android/widget/AbsListView.html#onTouchEvent(android.view.MotionEvent)

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-06-04
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多