开发者

Adding Image to Custom AlertDialog

I made a AlertDialog which let users choose 1 of the 4 options I display.

The first 3 let's them directly call a number when they click it and the 4th one displays a different view.

This is how it looks right now:

Adding Image to Custom AlertDialog

As the 4th option purposes a different task I want to make it look different because users can get confused.

I thought of putting an 'call-icon' next to the f开发者_Python百科irst 3 option and an arrow next to the 4th option.

Now remains my question; how do I put an image next to the first 3 options?

Here is the code that creates the dialog:

 public void AlarmMenu(){
 final CharSequence[] items = {"Politie", "Ambulance", "Brandweer", "Tips                                   >"};
 AlertDialog.Builder builder = new AlertDialog.Builder(this);
 builder.setItems(items, new DialogInterface.OnClickListener() {
     public void onClick(DialogInterface dialog, int item) {
            switch (item){
                case 0:
                    break;
                case 1:
                    break;
                case 2:
                    break;
                case 3:
                 break;
            }
     }
 });
 AlertDialog alert = builder.create();
 alert.show();
}


I dont think that you can do it with an AlertBuilder. You should rather choose to create a custom dialog following e.g. this tutorial:

http://about-android.blogspot.com/2010/02/create-custom-dialog.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜