2012-09-24 26 views
2

我有一個Android應用程序使用Alertdialog.I設置此對話框的動畫。我想從左上角開始動畫,並結束於右下角.ie,對話框想從頂端移動 - 在動畫持續時間內左至右下。如何更改警報對話框的位置

我該如何做到這一點?

+0

請參閱本:: http://stackoverflow.com/questions/4817014/animate-a-custom-dialog –

回答

5

試試這個

AlertDialog.Builder alert = new AlertDialog.Builder(this); 
     alert.setTitle("Final Result"); 
     alert.setMessage(msg); 
     alert.setPositiveButton("OK", 
       new DialogInterface.OnClickListener() { 

        public void onClick(DialogInterface dialog, int which) { 
         // TODO Auto-generated method stub 

        } 

       }); 


     // dlgAlert.create(); 
     AlertDialog dialog_card = alert.create(); 
     // dlgAlert.requestWindowFeature(Window.FEATURE_NO_TITLE); 
     // WindowManager.LayoutParams WMLP = 
     dialog_card.getWindow().setGravity(Gravity.TOP); 

     dialog_card.show();` 
+0

這段代碼顯示對話框始終在top.But我想要的對話框在動畫結束時在底部。 –

+0

從上到下改變它將帶來對話底部。如果工作,接受 –

+0

你知道是否有可能通過一個以上的引力進行對話? –