我正在尝试在我的类中使用以下代码:
final ImageView imageView = (ImageView) findViewById(R.id.imageView2);
imageView.setOnTouchListener(new OnSwipeTouchListener(context) {
@Override
public void onSwipeLeft() {
Intent intent2 = new Intent(GalleryView.this, GalleryView2.class);
startActivity(intent2);
finish();
}
});
}
它给了我错误:
context cannot be resolved to a variable
这是什么意思?我整个下午都搜索过,找不到答案。 它应该是什么而不是背景?
非常感谢。
我从以下代码获得了代码:
Android: How to handle right to left swipe gestures
并使用了Edward Brey的代码。不幸的是,我没有足够的积分直接向Edward Brey询问。
提前致谢。