AppCompatActivity创建鼠标接口监听是报错,为何代码如下
package com.example.administrator.demon1;
import android.content.DialogInterface;
import android.location.GpsStatus;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.AutoCompleteTextView;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.MultiAutoCompleteTextView;
import android.widget.RadioGroup;
import android.widget.ToggleButton;
import android.View.view;
import android.app.Activity;
import android.widget.RadioGroup;
import java.security.PublicKey;
import java.util.Objects;
public class MainActivity extends AppCompatActivity implements View.OnClickListener{
private ToggleButton tb;
private ImageView img;
private MultiAutoCompleteTextView macTextView;
private AutoCompleteTextView acTextView;
private String[] res = {"beijimng1", "beijing2", "beijing3",
"shanghai1", "shanghai2"};
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
acTextView = (AutoCompleteTextView) findViewById(R.id.autoCompleteTextView);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, res);
acTextView.setAdapter(adapter);
macTextView = (MultiAutoCompleteTextView) findViewById(R.id.multiAutoCompleteTextView);
macTextView.setAdapter(adapter);
macTextView.setTokenizer(new MultiAutoCompleteTextView.CommaTokenizer());
tb = (ToggleButton) findViewById(R.id.toggleButton);
img = (ImageView) findViewById(R.id.imageView);
}
}