请你帮我看看这个android程序为什么没有显示相应的通知
publicclassMainActivityextendsActivityimplementsOnClickListener{privateButtonbutton1;...
public class MainActivity extends Activity implements OnClickListener{
private Button button1 ;
private Button button2 ;
private Button button3 ;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button1=(Button)findViewById(R.id.button1);
button2=(Button)findViewById(R.id.button2);
button3=(Button)findViewById(R.id.button3);
}
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public void onClick(View v) {
switch(v.getId()){
case R.id.button1:
Toast.makeText(MainActivity.this,"第一个按钮",1).show();
break;
case R.id.button2:
Toast.makeText(MainActivity.this,"第二个按钮",1).show();
break;
case R.id.button3:
Toast.makeText(MainActivity.this,"第三个按钮",1).show();
break;
}
}
} 展开
private Button button1 ;
private Button button2 ;
private Button button3 ;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
button1=(Button)findViewById(R.id.button1);
button2=(Button)findViewById(R.id.button2);
button3=(Button)findViewById(R.id.button3);
}
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
public void onClick(View v) {
switch(v.getId()){
case R.id.button1:
Toast.makeText(MainActivity.this,"第一个按钮",1).show();
break;
case R.id.button2:
Toast.makeText(MainActivity.this,"第二个按钮",1).show();
break;
case R.id.button3:
Toast.makeText(MainActivity.this,"第三个按钮",1).show();
break;
}
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询