Hey, I'm facing a problem when trying to customize dialogs in my application. Here is the description.
I have an activity louching a Dialog created as follow protected Dialog onCreateDialog(int id) { Dialog selectorDialog; View layout = getLayoutInflater().inflate(R.layout.MyLayout, (ViewGroup) findViewById(R.id.root_layout)); selectorDialog = new Dialog(this, R.style.MyLayout); selectorDialog.addContentView(layout, new LayoutParams (LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); return selectorDialog; } For easy understanding MyLayout is a single line of Text (LinearLayout + TextView) I use a custom theme : <style name="MyTheme" parent="@android:style/Theme.Dialog"> <item name="android:windowBackground">@drawable/MyBackground</ item> </style> The result is nice, I have MyBackground image set for my selectorDialog but... I have a blank space that correspond to the dialog title and I don't want it !!! (If i set selectorDialog.setTitle("Test"); I can see "Test" written in the undesired space...) So I tried to set : selectorDialog.requestWindowFeature(Window.FEATURE_NO_TITLE); But the displayed dialog looks like the same as when I use an AlertDialog.Builder : protected Dialog onCreateDialog(int id) { Dialog selectorDialog; View layout = getLayoutInflater().inflate(R.layout.MyLayout, (ViewGroup) findViewById(R.id.root_layout)); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setView(layout); selectorDialog = builder.create(); return selectorDialog; } In the first case : selectorDialog.requestWindowFeature (Window.FEATURE_NO_TITLE); I set MyTheme when creating the Dialog instance but it doesn't seem that it takes effect. I have no title... but not the custom Dialog background specified in styles.xml In the second case I can't figure (out) how to set the theme... and I have the same result : no title but the standard Android AlertDialog Theme. I prospect in the platform (1.5) /res And i Find in themes.xml : <item name="alertDialogStyle">@android:style/AlertDialog</item> And in styles.xml : <style name="AlertDialog"> <item name="fullDark">@android:drawable/popup_full_dark</item> <item name="topDark">@android:drawable/popup_top_dark</item> <item name="centerDark">@android:drawable/popup_center_dark</ item> <item name="bottomDark">@android:drawable/popup_bottom_dark</ item> <item name="fullBright">@android:drawable/popup_full_bright</ item> <item name="topBright">@android:drawable/popup_top_bright</ item> <item name="centerBright">@android:drawable/ popup_center_bright</item> <item name="bottomBright">@android:drawable/ popup_bottom_bright</item> <item name="bottomMedium">@android:drawable/ popup_bottom_medium</item> <item name="centerMedium">@android:drawable/ popup_center_medium</item> </style> I also tried to extend this AlerteDialog style but the attributes fullDark, topDark, ... are not public so I can't override those properties.... Moreover I dont want to override 10 properties I have a single custom NinePathDrawable that fits perfectly for my dialog background !!!!!! Has one of you already manage to set a custom background for a custom Dialog without having the useless title space displayed ? Is there anyway to customize this by themes & styles ? Thank you for your help. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---