在视图之间切换时出现错误。我android:onClick="onClick"
在 xml 中的每个图像按钮上都有。这是代码
selfHelp = (ImageButton)findViewById(R.id.selfhelpButton);
services = (ImageButton)findViewById(R.id.services);
messages = (ImageButton)findViewById(R.id.mailButton);
about = (ImageButton)findViewById(R.id.aboutButton);
more = (ImageButton)findViewById(R.id.moreButton);
selfHelp.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), SelfHelp.class);
startActivity(myIntent);
}
});
Services.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), Services.class);
startActivity(myIntent);
}
});
messages.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), Messages.class);
startActivity(myIntent);
}
});
about.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), About.class);
startActivity(myIntent);
}
});
more.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
Intent myIntent = new Intent(view.getContext(), More.class);
startActivity(myIntent);
}
});
我在另一个页面上只有一个按钮,但图像按钮不起作用。任何帮助都会很棒