1

I'm created a custom AlertDialog, but image

it have a default black border. How can I hide it? My layout

props - match_parent,

style - @android:style/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>
Gorets
  • 2,434
  • 5
  • 27
  • 45

2 Answers2

1

The border is due to the fact that you might have set your custom layout (probably inflated) as the content view of the dialog.
I think AlertDialogs are composed by (at least) 3 layouts, one for the title, one for the content and one last for the buttons. So the little border you see might be the layout for the buttons.
I don't know how to make it disappear, anyway if you want custom dialogs without thoses borders, you can create a class that extends Activity, and use the @android:style/Theme.Dialog to make it look like a dialog. Then you can fully manage what your activity do/not shows.

Mickäel A.
  • 9,012
  • 5
  • 54
  • 71
0

What you are able to see is the default Style for any AlertDialog which normally varies from Device to Device. I tried a few times to change it, but I was not successful. So what I did is, I used the super Class Dialog and created my own AlertDialog.

Here is a link to my answer,

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

Since you are using your own layout, I believe that it will be of the same value.

Community
  • 1
  • 1
Andro Selva
  • 53,910
  • 52
  • 193
  • 240