1

The problem started when i was trying to dismiss the dialog on the close button being pressed.

I couldn't get it working with my original approach so i tried this one and it has a weird border around the dialog when being presented.

Here is the dialog class:

package com.Pivotl.PostcardsFromAlaska;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.DialogFragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;

public class PFADialogFragment extends DialogFragment {
    static PFADialogFragment newInstance() {
        PFADialogFragment f = new PFADialogFragment();
        return f;
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        //getting proper access to LayoutInflater is the trick
        LayoutInflater inflater = getActivity().getLayoutInflater();

        View view = inflater.inflate(R.layout.enter_actions, null);
        //propManager = new PropManager(getSherlockActivity());
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setView(view);
        return builder.create();
    }

}

The dialogs view:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:padding="3dp" >

    <LinearLayout
        android:id="@+id/linearLayout1"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerInParent="true"
        android:layout_marginRight="166dp"
        android:background="@layout/roundedshape"
        android:orientation="vertical"
        android:paddingBottom="10dp"
        android:paddingLeft="5dp"
        android:paddingRight="5dp" >

        <Button
            android:id="@+id/closeButton"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:layout_marginBottom="20dp"
            android:layout_marginLeft="135dp"
            android:layout_marginTop="5dp"
            android:background="@drawable/close2x"
            android:onClick="closeButtonClick" />

        <Button
            android:id="@+id/takePictureButton"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:background="@drawable/big_button2x"
            android:onClick="takePictureButtonClick" />

        <Button
            android:id="@+id/photoGalleryButton"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:background="@drawable/big_button2x"
            android:onClick="photoGalleryButtonClick" />

        <Button
            android:id="@+id/artistGalleryButton"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginBottom="10dp"
            android:background="@drawable/big_button2x"
            android:onClick="artistGalleryButtonClick" />

    </LinearLayout>

</RelativeLayout>

I access and show it on protected void onCreate(Bundle savedInstanceState) using :

    if(!diagShowing)
   {
    showDialog();
   }

But when it shows it looks like the below: White border

Why would it be displaying this border and how can i get it to display only my view?

Any help, appreciated!!

Keeano
  • 309
  • 8
  • 33

2 Answers2

0

Add a transparent background to your RelativeLayout such as :

android:background="@android:color/transparent"

or

android:background="#00000000"

or you can also create a theme for your custom dialog

Yann Masoch
  • 1,628
  • 1
  • 15
  • 20
  • Did you try `getDialog().getWindow().setBackgroundDrawable(new ColorDrawable(0));` in the `onCreatView`. `ColorDrawable` can be: `ColorDrawable(Color.TRANSPARENT)` or `ColorDrawable(0)`. It's the same thing. http://stackoverflow.com/questions/8045556/cant-make-the-custom-dialogfragment-transparent-over-the-fragment – Yann Masoch Aug 01 '13 at 17:37
  • i tried this as well, that actually gives me a nullpointer exception @Yann Masoch – Keeano Aug 01 '13 at 23:53
0

Call a method in onCreate,such as:

@Override public void onCreate(Bundle savedInstanceState) {

          super.onCreate(savedInstanceState);
          setStyle(STYLE_NO_FRAME,0);

}

  • I tried this as well and it still shows up, i tried it in my Dialog class as well as the main class...both still show border. – Keeano Aug 01 '13 at 02:05