protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);…
Jump to turn (8)
- 1protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanc
- 2package edu.bpi.dialogxsy; import androidx.appcompat.app.AppCompatActivity; impo
- 3先说消息对话框的步骤
- 4按照我发的那个长代码说
- 5textViewxsy =findViewById(R.id.textViewxsy); button1 =findViewById(R.id.button);
- 6button1.setOnClickListener(new View.OnClickListener() 解释其作用
- 7dialog.setTitle("小心驶得万年船"); dialog.setMessage("我喜欢学习Android"); dialog.setIcon(R.
- 8dialog.setNegativeButton("取消",new DialogInterface.OnClickListener() { @Override
- User
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_xsy); textView_xsy =findViewById(R.id.textView_xsy); button1 =findViewById(R.id.button); button2=findViewById(R.id.button2); button3 =findViewById(R.id.button3); button4 =findViewById(R.id.button4); button5 =findViewById(R.id.button5); button1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { AlertDialog.Builder dialog = new AlertDialog.Builder(MainActivity.this); dialog.setTitle("小心驶得万年船"); dialog.setMessage("我喜欢学习Android"); dialog.setIcon(R.drawable.gantan); dialog.setPositiveButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { textView_xsy.setText("你点击了确定按钮"); } }); dialog.setNegativeButton("取消",new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { textView_xsy.setText("你点击了取消按钮"); } }); dialog.setNeutralButton("普通", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { textView_xsy.setText("你点击了普通按钮"); } });