views:

26

answers:

1

Hi, I want to set the AlertDialog position behind the status bar, when the content in my Dialog will increase, How to do that? I am creating a custom AlertDialog using my own layout.... Please help me out....

A: 

Below is my code, I am setting the height and x-y position of alertDialog, but still it doesnot show its effect..

AlertDialog.Builder builder = new AlertDialog.Builder(this);
       LayoutInflater inf = getLayoutInflater();
        View layout = inf.inflate(R.layout.main, null);
        builder.setView(layout);
        builder.setTitle("Add to Home screen");
    AlertDialog dialog = builder.create();
        WindowManager.LayoutParams WMLP = dialog.getWindow().getAttributes();
        int dialogOriginalHeight = WMLP.height;
    WMLP.height += 750;
    Log.i("XnY", "x="+WMLP.x+", y="+WMLP.y);
    WMLP.x = -10;   //x position
    WMLP.y = -10;   //y position
    Log.i("XnY", "x="+WMLP.x+", y="+WMLP.y);
    dialog.getWindow().setAttributes(WMLP);
    Log.i("POSITION", "POS::HEIGHT:"+WMLP.height);
    dialog.show();
kishore