1

i have written a program for a dialog box which pops up when clicked on the image button , but unfortunately its header background is black and i m not able to change its color , the portion above my text Dialog Box, i will post a snapshot of my dialog box , please need some help enter image description here

@Override
        public void onClick(View v) {

            PopupMenu popup = new PopupMenu(wrapper, v);

            popup.getMenuInflater().inflate(R.menu.home, popup.getMenu());

            popup.setOnMenuItemClickListener(new OnMenuItemClickListener() {

                @Override
                public boolean onMenuItemClick(MenuItem item) {

                    android.app.FragmentManager manager = getFragmentManager();
                    final MenuDialog dialog = new MenuDialog();

                    dialog.show(manager, "About App");

                    return true;
                }
            });
            popup.show();
        }
    });
arjun narahari
  • 176
  • 6
  • 26

1 Answers1

1

You can use the code

final Dialog mailDialog = new Dialog(MainActivity.this);
mailDialog.getWindow().setBackgroundDrawableResource(R.drawable.dialog_box);

dialog_box.xml

<?xml version="1.0" encoding="utf-8"?>

<corners
    android:bottomLeftRadius="5dp"
    android:bottomRightRadius="5dp"
    android:topLeftRadius="5dp"
    android:topRightRadius="5dp" />

<gradient
    android:angle="-90"
    android:centerColor="#660D1E4A"
    android:endColor="#66011444"
    android:startColor="#66505E7F"
    android:type="linear"
     />

<stroke
    android:dashGap="0dp"
    android:dashWidth="0dp"
    android:width="1dp"
    android:color="#ffffffff" />

This is a custom dialog box you can add as much attribute you want.Hope this Would help

thestrongenough
  • 225
  • 2
  • 14