尝试使用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();
}
}
答案 0 :(得分:4)
您没有将extends
与接口一起使用,而是使用implements
。
public class RecyclerTouchListener implements RecyclerView.OnItemTouchListener