Reputation: 2442
I'm created a custom AlertDialog, but
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>
Upvotes: 1
Views: 475
Reputation: 9357
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.
Upvotes: 1
Reputation: 54322
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.
Upvotes: 0