2012-08-01 133 views
1

我創建了一個自定義AlertDialog,但image自定義AlertDialog

它有一個默認的黑色邊框。我怎樣才能隱藏它? 我的佈局

道具 - match_parent,

風格 - @android:款式/ Theme.Translucent.NoTitleBar.Fullscreen

UPD

@Override 
protected Dialog onCreateDialog(int id) { 
    AlertDialog.Builder builder = new AlertDialog.Builder(this); 
    LayoutInflater inflater = getLayoutInflater(); 
    View dialoglayout = inflater.inflate(R.layout.dialog_layout, (ViewGroup) getCurrentFocus()); 
    switch (id) { 
    case IDD_RESULT: 
     builder.setView(dialoglayout); 
     return builder.create(); 

XML

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/dialog_layout_root" 
    style="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <LinearLayout 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/dialog_bg" 
     android:orientation="vertical" > 

    </LinearLayout> 

</LinearLayout> 
+0

發佈您用來創建它的代碼..這是不夠的。 – 2012-08-01 12:49:07

回答

0

你能看到什麼是通常由不同的設備到設備的任何AlertDialog的默認樣式。我試了幾次來改變它,但我沒有成功。所以我所做的是,我使用了超類對話框並創建了我自己的AlertDialog。

這裏是我的答案的鏈接,

https://stackoverflow.com/a/11608468/603744

由於您使用自己的佈局,我相信,這將是相同的值。

1

該bord呃是因爲你可能已經將你的自定義佈局(可能是誇大的)設置爲對話框的內容視圖。
我認爲AlertDialogs由(至少)3個佈局組成,一個用於標題,一個用於內容,最後一個用於按鈕。所以你看到的小邊框可能是按鈕的佈局。
我不知道如何使它消失,反正如果你想定製對話框無國界放入系統,您可以創建擴展Activity類,並使用@android:style/Theme.Dialog,使它看起來像一個對話框。那麼你可以完全管理你的活動做/不做。