2013-08-06 32 views
0

我正在研究一個允許用戶動態添加編輯文本的android應用程序。我可以使用警報對話框添加編輯文本。但我需要使對話框透明。我需要能夠在後臺看到imageview。 Color.Transparent不會起作用,因爲我的背景是一個圖像將對話框的背景設置爲透明

+2

我很困惑..你想將edittext的背景設置爲透明或對話框背景嗎? –

回答

1

試試這個:

Dialog mDialog = new Dialog(mContext, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen); 

我用
mDialog.getWindow().setBackgroundDrawable(new ColorDrawable(0)); 
1

你可以試試這個

<EditText 
     android:id="@+id/purpose_textfield" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="@null"/> 
+0

看起來用戶在問關於Dialog的背景! –

+0

yepp ..問題的標題是真的讓人誤解 – peshkira

1

所迷離定製對話框在我的一個項目中。

以下是摘錄。 U可以根據自己的需要

private void ShowBluredDialog() { 
      // TODO Auto-generated method stub 

      final Dialog dialog = new Dialog(MyActivity.this); 
      dialog.getWindow(); 
      dialog.requestWindowFeature(Window.FEATURE_NO_TITLE); 
      dialog.setContentView(R.layout.custom); 

      dialog.setCancelable(false); 
      RelativeLayout myview=(RelativeLayout)dialog.findViewById(R.id.pauselayout); 

      AlphaAnimation alpha = new AlphaAnimation(0.5F, 0.5F); 
      alpha.setDuration(0); // Make animation instant 
      alpha.setFillAfter(true); // Tell it to persist after the animation ends 
      // And then on your layout 
      myview.startAnimation(alpha); 
      ImageButton playButton=(ImageButton)dialog.findViewById(R.id.imagePlay); 

      playButton.setOnClickListener(new View.OnClickListener() { 

       @Override 
       public void onClick(View arg0) { 
        // TODO Auto-generated method stub 

        dialog.dismiss(); 

       } 
      }); 

      dialog.show(); 
     } 
0

而是採用警告對話框的使用,我更喜歡你使用對話框:

,並使用此代碼:

對話的對話=新的對話框(getBaseContext, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);