简体   繁体   中英

How to make a window in an activity?

I want to make a new window in an activity. like a popup window. I saw the source code of the Email application shipped with android OS and found this

import com.android.internal.policy.PolicyManager
Window w = PolicyManager.makeNewWindow(mContext);

But I can't find such a class in the SDK. Any idea?

android.widget.PopupWindow might be what you're after. http://developer.android.com/reference/android/widget/PopupWindow.html

Depending on what you're trying to do though, you may prefer using a dialog or an activity that isn't fullscreen.

Just a side note. PopupWindow doesn't work well with Preferences screens. AlertDialog is not themable.

You can use an AlertDialog or just use an Activity but with a dialog theme placing:

android:theme="@android:style/Theme.Dialog"

in your AndroidManifest file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM