有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java公共类MainActivity扩展了AppCompatActivity,实现了GestureDetector。OnEstureListener

public class MainActivity extends AppCompatActivity implements GestureDetector.OnGestureListener {

    private GestureDetectorCompat gestureDetector;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        Log.i(TAG, "onCreate");

        this.gestureDetector = new GestureDetectorCompat(this,this);
    }

这一行:

public class MainActivity extends AppCompatActivity implements GestureDetector.OnGestureListener 

为红色,显示以下错误:

Error:(12, 8) error: MainActivity is not abstract and does not override abstract method onLongPress(MotionEvent) in OnGestureListener


共 (2) 个答案

  1. # 2 楼答案

    首先,导入必要的标题。[如果是windows,则按组合键cmd+shift+O]

    之后,您将在MainActivity下看到一个错误。将光标移到MainActivity并单击Implemental methods