I have made a custom Dialog, and I want the title to have a background like the AlertDialog.
Better said:
The place where it says "Custom Dialog"
Needs to have a 'header' like this:
I don't want to just add the image left to the text, but really implement the complete UI style shown.
Is this possible?
Here's the code I used for my custom dialog: Adding Image to Custom AlertDialog
Dialog: A dialog is a small window that prompts the user to make a decision or enter additional information. DialogFragment: A DialogFragment is a special fragment subclass that is designed for creating and hosting dialogs.
java file to add alert dialog code to launch the dialog. Modify layout XML file res/layout/activity_main. xml add any GUI component if required. Run the application and choose a running android device and install the application on it and verify the results.
Alert Dialog code has three methods:setTitle() method for displaying the Alert Dialog box Title. setMessage() method for displaying the message. setIcon() method is used to set the icon on the Alert dialog box.
Galip this is the code that worked for me
Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.dialoglayout);
dialog.setTitle("Pick A Colour");
and in my dialoglayout I had root element RadioGroup
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With