Friday, August 31, 2012

[android-developers] Re: How to attach actionbar on dialog?

Hello, yes, I found a "solution":

I used a activity instead...

<style name="PopupTheme" parent="android:Theme.Holo.Light.Dialog">
        <item name="android:windowIsFloating">false</item>
        <item name="android:windowContentOverlay">@null</item>
        <item name="android:windowSoftInputMode">stateAlwaysHidden</item>
        <item name="android:windowActionModeOverlay">true</item>
        <item name="android:windowIsTranslucent">true</item>

public static void showAsPopup(Activity activity) {
        //To show activity as dialog and dim the background, you need to declare android:theme="@style/PopupTheme" on for the chosen activity on the manifest
        LayoutParams params = activity.getWindow().getAttributes();
        params.height = LayoutParams.FILL_PARENT;
        params.width = 850; //fixed width
        params.alpha = 1.0f;
        params.dimAmount = 0.5f;
        activity.getWindow().setAttributes((android.view.WindowManager.LayoutParams) params);

Good luck!

2012/8/31 Christophe Versieux <>
Did you find an answer? I have the same question...

On Wednesday, September 21, 2011 9:11:28 PM UTC+2, Igor Oliveira wrote:
Hello, I would like to know how to implement a screen like the EditEventActivity from Android Calendar on Android 3.1.

See picture below:

I've created a dialog and I'm trying to put a actionbar on the dialog via onCreateOptionsMenu(), but the action bar doesn't appear.

I'm using <uses-sdk android:minSdkVersion="12" android:targetSdkVersion="12"/> and the Theme.Holo.Light.Dialog on the dialog.

When I call getActionBar() I always get null.

From documentation:
"ActionBar     getActionBar()
Retrieve the ActionBar attached to this dialog, if present."

So how can I attach a dialog on a dialog? Can you help me?

Thanks in advance.

Igor Oliveira

Igor Oliveira

You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment