需要在Alert框对话框中创建行间距

时间:2013-10-05 20:37:41

标签: java android

这是我的代码:

public void create_dialoginfo()
    {
        AlertDialog.Builder alert = new AlertDialog.Builder(main.this);
        alert.setTitle("911 Info");
        alert.setMessage(
                "Button Description: " +
                "" +
                "1. Calls 911 " +
                "2. Sends GPS Cordinates to Contact " +
                "3. Activates a monitored call " +
                "4. Activates alarm and captures images to web for viewing");
        alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() 
        {   
            public void onClick(DialogInterface dialog, int which) 
            {
                // TODO Auto-generated method stub  
            }
        });
        alert.create();
        alert.show();
    }

已创建“警报”框,但没有行间距,您使用什么来创建行间距?

1 个答案:

答案 0 :(得分:0)

使用\ n作为下一行

AlertDialog.Builder alert = new AlertDialog.Builder(this);
            alert.setTitle("911 Info");
            alert.setMessage("Button Description: \n1. Calls 911\n2. Sends GPS Cordinates to Contact\n3. Activates a monitored call\n4. Activates alarm and captures images to web for viewing");
            alert.setPositiveButton("Ok",
                    new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            // TODO Auto-generated method stub
                        }
                    });
            alert.create();
            alert.show();