2011-05-06 5 views
2

이미지 텍스트와 버튼으로 맞춤 AlertDialog을 만들려고합니다. 그것을 표시 할 때 나는 끔찍한 흰색 테두리를 얻습니다.사용자 정의 AlertDialog에서 테두리를 제거하는 방법은 무엇입니까?

enter image description here

어떻게 내가 그 흰색 테두리 제거 할 수

? 여기

내 사용자 지정 대화 상자 :

public LinearLayout customeLL; 
    public void alertD() 
    { 
     AlertDialog ad; 
     AlertDialog.Builder builder; 
     Context mContext = getApplicationContext(); 
     TextView a = new TextView(getApplicationContext()); 
     a.setText("Test dialog"); 
     ImageView img = new ImageView(getApplicationContext()); 
     img.setBackgroundResource(R.drawable.bottombar_bg); 
     LinearLayout customeLL = new LinearLayout(getApplicationContext()); 
     customeLL.setOrientation(LinearLayout.VERTICAL); 
     customeLL.addView(img,curWidth,37); 
     customeLL.addView(a,curWidth,37); 
     builder = new AlertDialog.Builder(myClass.this); 
     builder.setView(customeLL); 
     ad=builder.create(); 
     ad.show(); 

    } 

당신이 topborder 및 이미지는 2-3 픽셀의 공간이 볼 수 있듯이. 당신이 대화 테두리 당신이이 여러분이 원하는 색으로 표시 할 경우

+0

흰색 보어가 무슨 뜻입니까? – ingsaurabh

+0

그냥 테두리. alertDialog의 테두리 (기본값은 흰색 테두리 임) – Peter

+0

경고 대신 대화 상자를 사용할 수 있습니다 ..? –

답변

10

..

Dialog dialog = new Dialog(this,android.R.style.Theme_Translucent_NoTitleBar); 
+0

고마워,하지만 제목 만 지워. 테두리 제거가 필요해. ((최고 흰색 줄의 이미지를 보아라 .- 당신이 시도한 ????? – Peter

+0

을 제거하는 것이 가능하다.) 테두리 제거 line .... –

+0

방금 ​​제목이나 테두리가없는 사용자 정의 테마로 떠 다니는 Dialog를 보여주는 요지를 게시했습니다 : https://gist.github.com/2643546 –

2

이 제거됩니다 경계 :

AlertDialog ad; 
ad= new AlertDialog.Builder(context).create(); 
ad.show(); 
ad.setContentView(R.layout.dialog_layout); // set your custom layout 

// Then initialize your dialog views like this 
TextView txt= (TextView) ad.findViewById(R.id.dialog_text); // a TextView inside dialog 
                  // layout 
txt.setText("I'm a custom dialog!"); 

은 또한, 나는 전체 화면 모드에서 사용자 정의 대화 상자를 사용하여 문제가 있었다 여기에 대한 좋은 기사가있다. 대화 상자가 닫히지 않으면 내 전화의 알림 표시 줄이 계속 나타납니다. 사용자 정의 AlertDialog를 사용하면 문제가되지 않습니다.)

관련 문제