本文介绍了将图像转换成敬酒一个图像AlertDialog的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
sas3.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// TODO Auto-generated method stub" "
Toast toast= Toast.makeText(getApplicationContext(),
" ",
Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0, 0);
LinearLayout toastView = (LinearLayout) toast.getView();
ImageView imageCodeProject = new ImageView(getApplicationContext());
imageCodeProject.setImageResource(R.drawable.symptom_muscle_pain);
toastView.addView(imageCodeProject, 0);
toast.show();
}
});
谁能帮我这个转换成敬酒一个警告对话框。?。
请不要降级me..i'm只是一个初学者在机器人..
Can anyone help me convert this toast into an Alert Dialog.?.Please don't downgrade me..i'm just a beginner in android..
推荐答案
试试这样
AlertDialog.Builder alertDialoBuilder;
public void getAlertDialog(String title, String message){
if(alertDialoBuilder!= null)
alertDialoBuilder= null;
alertDialoBuilder= new AlertDialog.Builder(this);
alertDialoBuilder.setTitle(title);
alertDialoBuilder.setMessage(message);
alertDialoBuilder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
//you can implement negative button also if you need it
alertDialoBuilder.create().show();
}
这篇关于将图像转换成敬酒一个图像AlertDialog的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!