没有接口预期RecyclerView.OnItemTouchListener

时间:2016-09-18 03:25:25

标签: android

尝试使用Android Studio实现RecyclerView ItemClickListener,但收到错误

" 此处没有预期接口"

当我尝试将RecyclerToushListener扩展为RecyclerView.onItemTouchListener时,我会收到此错误

import android.support.v7.widget.RecyclerView;
import android.view.MotionEvent;

    /**
 * Created by Admin on 9/18/2016.
 */
public class RecyclerTouchListener extends RecyclerView.OnItemTouchListener {
    @Override
    public boolean onInterceptTouchEvent(RecyclerView rv, MotionEvent e) {
        return false;
    }

    @Override
    public void onTouchEvent(RecyclerView rv, MotionEvent e) {

    }

    @Override
    public void onRequestDisallowInterceptTouchEvent(boolean disallowIntercept) {

    }

  public interface  clicklistener{
        public void onItemclick();
    }
    }

1 个答案:

答案 0 :(得分:4)

您没有将extends与接口一起使用,而是使用implements

public class RecyclerTouchListener implements RecyclerView.OnItemTouchListener