I think that the easiest way to solve this problem is to set the theme
in your manifest file to Theme.Dialog and then simply say

requestWindowFeature ( Window.FEATURE_NO_TITLE );
custom = new Custom(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 Dialog theme:
>
> > > <?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 the theme, 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 a custom frame 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to