2014-01-17 118 views
2

Alret Widdow警告對話框準備

嗨,

我需要一些幫助,以去除在警報對話框邊緣出現的暗色,但在同一時間,我需要的暗淡背景活性。

如果你看到圖像正確,你會發現兩種顏色 1 - 出現在警報對話框(我需要刪除)。另一個是背景活動的昏暗背景(需要在那裏)。

***我已經刪除,我已經使用了警告對話框custum_dialog佈局的國際R

我對警報,對話框窗口代碼如下

LayoutInflater factory = LayoutInflater.from(activity); 
     final View deleteDialogView = factory.inflate(
       R.layout.custum_dialog, null); 

     TextView tv=(TextView) deleteDialogView.findViewById(R.id.errormsg); 
     tv.setText(getErrMsg()); 
     //tv.setText("jsfj ajsd jkasd j juasdf jbasd u uasd juasd "); 
     final AlertDialog deleteDialog = new AlertDialog.Builder(activity).create(); 
     deleteDialog.setView(deleteDialogView); 
     deleteDialog.setInverseBackgroundForced(true); 
     // deleteDialog.getWindow().clearFlags(android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND); 

     //deleteDialog.setCustomTitle(tv); 
     deleteDialogView.findViewById(R.id.okbtn).setOnClickListener(new OnClickListener() { 

      @Override 
      public void onClick(View v) { 
       //your business logic 
       deleteDialog.dismiss(); 
      } 
     }); 


     deleteDialog.show(); 
    // Remove padding from parent 
+1

你能發佈「custum_dialog.xml」嗎? – s1m3n

回答

2

你只需要創建Custom Dialog Theme並設置爲您Dialog像下面的styles.xml

<style name="Theme_Dialog" parent="android:Theme.Holo.Dialog"> 
    <item name="android:windowNoTitle">true</item> 
    <item name="android:layout_width">fill_parent</item> 
    <item name="android:backgroundDimEnabled">true</item> 
    <item name="android:windowBackground">@android:color/transparent</item> 
</style> 

現在,這個主題設爲您的Dialog如下:

Dialog main_dialog = new Dialog(Splash.this,R.style.Theme_Dialog); 

並根據您的要求定製此主題參數。 thnx