I figured it out! First create a file named translucent_background.xml in res/drawable:
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#00000000"/> <padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp" /> </shape> Then use something similar to the following for your theme: <?xml version="1.0" encoding="utf-8"?> <resources> <style name="TranslucentTheme" parent="@android:style/ Theme.Translucent"> <item name="android:background">@drawable/translucent_box</item> <item name="android:windowNoTitle">true</item> </style> </resources> On Sep 1, 1:22 am, Tikoze <[email protected]> wrote: > That works like a charm, except.... > > Doing it that way causes the application to briefly display the title > bar before being removed(at least it is for me, anyway). In my > opinion it looks very unprofessional. If I set the needed values in > the xml file via the windowNoTitle method then this flashing of the > title bar does not occur, but I then get a black background. > > BTW, I am using Theme.Translucent. Theme.Dialog just doesn't look > right for my app, but the results are the same regardless of the theme > I try to inherit from... Black Screen Of Death! > > Has anyone come up with a way to do this in the xml files? > > Thanks, > Justin > > On Aug 24, 5:41 am, LambergaR <[email protected]> wrote: > > > I think that the easiest way to solve this problem is to set thetheme > > in your manifest file toTheme.Dialog and then simply say > > > requestWindowFeature ( Window.FEATURE_NO_TITLE );custom= > > newCustom(getApplicationContext ()); > > setContentView (custom); > > > Works like a charm! :) > > > On 22 avg., 07:37, CraigsRace <[email protected]> wrote: > > > > BTW: My dialogs were dying because I was opening them outside the > > > onCreateDialog method. Once I moved them in there, everything worked > > > great. Ref:http://developer.android.com/guide/topics/ui/dialogs.html > > > > On Aug 13, 10:41 am, CraigsRace <[email protected]> wrote: > > > > > Well, I did it this way. Create your dialog that extends Dialog. In > > > > the constructor call: > > > > requestWindowFeature(Window.FEATURE_NO_TITLE); > > > > this.getContext().setTheme(R.style.MyCustomTheme); > > > > setContentView(R.layout.your_layout); > > > > > Put all the initialisation of all your stuff in onCreate. > > > > > Then to open the dialog from an activity simply do this: > > > > new YourDialog(this).show(); > > > > > No need for anything in the manifest. You may want to add a > > > > OnDismissListener also. > > > > > One downside of this approach is that if the screen orientation > > > > changes, the dialog dies. I think you can code around this, but I > > > > haven't done that yet. > > > > > On Aug 11, 7:12 pm,LambergaR<[email protected]> wrote: > > > > > > Hi! > > > > > > I am facing a similar problem. All I want to do is remove the title > > > > > from an Activity that I am trying to show as a Dialog. Could you > > > > > please post some more details on how you managed to solve the problem? > > > > > > I am using the following code to modify the Dialogtheme: > > > > > > <?xml version="1.0" encoding="utf-8"?> > > > > > <resources> > > > > > <style name="MyCustomTheme" parent="@android:style/ > > > > >Theme.Dialog"> > > > > > <item name="android:windowNoTitle">true</item> > > > > > </style> > > > > > </resources> > > > > > > It doesn't matter where I apply thetheme, I always loose the > > > > > background. > > > > > > Thanks! > > > > > > On 11 avg., 08:02, CraigsRace <[email protected]> wrote: > > > > > > > I kept running into this problem, and I think I have found the > > > > > > cause. > > > > > > > Specifying an activity is a dialog in the manifest, for me, kept > > > > > > causing the background screen to be lost (not all the time - some > > > > > > dialogs would work ok). However, if I made my dialogs via code, Ie: > > > > > > sub-classed Dialog, and in the dialog I call > > > > > > this.getContext().setTheme > > > > > > (R.style.SpecialDialog); Then, so far, it keeps the background > > > > > > screen. Hooray! > > > > > > > On Aug 7, 12:03 am, CraigsRace <[email protected]> wrote: > > > > > > > > The parent window had a 120Kb jpeg picture on it. I used more > > > > > > > compression on the jpeg and got it down to 32Kb, and bingo, the > > > > > > > parent > > > > > > > window stopped disappearing! Yay me! > > > > > > > > On Aug 6, 10:39 am, CraigsRace <[email protected]> wrote: > > > > > > > > > Hi, > > > > > > > > > I wanted to change the frame around my Dialog. So I set up a > > > > > > > > style: > > > > > > > > <resources> > > > > > > > > <style name="SpecialDialog" parent="android:Theme.Dialog"> > > > > > > > > <item > > > > > > > > name="android:windowBackground">@drawable/my_frame</ > > > > > > > > item> > > > > > > > > </style> > > > > > > > > </resources> > > > > > > > > > and assigned it in the manifest: > > > > > > > > <activity android:name=".MyActivity" > > > > > > > > android:theme="@style/ > > > > > > > > SpecialDialog"> > > > > > > > > > And yay! I get my new frame. However, the parent window > > > > > > > > disappears > > > > > > > > (goes black). > > > > > > > > > Having a normal dialog: > > > > > > > > <activity android:name=".MyActivity" > > > > > > > > android:theme="@android:style/> >Theme.Dialog"> > > > > > > > > keeps the parent window visible. > > > > > > > > > Can I have acustomframe on a dialog and keep the parent window > > > > > > > > visible? > > > > > > > > > Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

