android对话框应用
来源:网络 责任编辑:栏目编辑 发表时间:2013-07-01 22:11 点击:次
啥都别说了,看效果吧!
1代码
new AlertDialog.Builder(Lesson_01_Pic.this).setTitle("提示标题").setMessage("这是提示内容").show();
2代码
new AlertDialog.Builder(Lesson_01_Pic.this)
.setTitle("这是标题")
.setMessage("这是提示内容")
.setPositiveButton("确定",
new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialoginterface, int i){
//按钮事件
Toast.makeText(Lesson_01_Pic.this, "确定",Toast.LENGTH_LONG).show();
}
}).show();
3代码
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnMultiChoiceClickListener;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class Lesson_02_Dia extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button button = (Button)findViewById(R.id.b01);
button.setText("对话框");
button.setOnClickListener(new Button.OnClickListener(){
@Override
public void onClick(View v) {
//选项数组
String[] choices={"Facebook","Twitter"};
//Check判断数组,与选项对应
boolean[] chsBool = {tr
1代码
new AlertDialog.Builder(Lesson_01_Pic.this).setTitle("提示标题").setMessage("这是提示内容").show();
2代码
new AlertDialog.Builder(Lesson_01_Pic.this)
.setTitle("这是标题")
.setMessage("这是提示内容")
.setPositiveButton("确定",
new DialogInterface.OnClickListener(){
public void onClick(DialogInterface dialoginterface, int i){
//按钮事件
Toast.makeText(Lesson_01_Pic.this, "确定",Toast.LENGTH_LONG).show();
}
}).show();
3代码
import android.app.Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnMultiChoiceClickListener;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class Lesson_02_Dia extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button button = (Button)findViewById(R.id.b01);
button.setText("对话框");
button.setOnClickListener(new Button.OnClickListener(){
@Override
public void onClick(View v) {
//选项数组
String[] choices={"Facebook","Twitter"};
//Check判断数组,与选项对应
boolean[] chsBool = {tr
相关新闻>>
最新推荐更多>>>
- 发表评论
-
- 最新评论 更多>>