public static class


extends ViewGroup.LayoutParams
implements Parcelable
   ? android.view.ViewGroup.LayoutParams
     ? android.view.WindowManager.LayoutParams
 WindowManager.LayoutParams 是 WindowManager 接口的嵌套类;它继承于 ViewGroup.LayoutParams; 它用于向WindowManager描述Window的管理策略。
Window flag系列
该系列主要用于对Window的flag进行设置。设置Window的flag,可以直接对Window的getAttributes()得到其 WindowManager.LayoutParams对象,然后直接对它flag变量操作。也可以Window的addFlags(int flags)方法,setFlags(int flags, int mask)方法,clearFlags(int flags)方法进行操作。
 Window window = getWindow(); 
 WindowManager.LayoutParams winParams = win.getAttributes();
 window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 
 Window window = getWindow(); 
window.setFlags(0, WindowManager.LayoutParams.FLAG_FULLSCREEN);
所有Window flag如下:
int FLAGS_CHANGED 用于表示flags发生了变化,关于此的详细内容请看后文。
int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON Window flag: as long as this window is visible to the user, allow the lock screen to activate while the screen is on.
int FLAG_ALT_FOCUSABLE_IM Window flag: invert the state of FLAG_NOT_FOCUSABLE with respect to how this window interacts with the current method.
int FLAG_BLUR_BEHIND Window flag: blur everything behind this window.
int FLAG_DIM_BEHIND Window flag: everything behind this window will be dimmed.
int FLAG_DISMISS_KEYGUARD Window flag: when set the window will cause the keyguard to be dismissed,
only if it is not a secure lock keyguard.
int FLAG_DITHER Window flag: turn on dithering when compositing this window to the screen.
int FLAG_FORCE_NOT_FULLSCREEN Window flag: Override {@link #FLAG_FULLSCREEN and force the screen decorations (such as status bar) to be shown.
恢复window非全屏显示  (让背景不是暗淡的
int FLAG_FULLSCREEN Window flag: Hide all screen decorations (e.g.

Indicates whether this window should be hardware accelerated.


该flag必须在设置你的Activity或Dialog的Content View之前进行设置,


int FLAG_IGNORE_CHEEK_PRESSES Window flag: intended for windows that will often be used when the user is holding the screen against their face, it will aggressively filter the event stream to prevent unintended presses in this situation that may not be desired for a particular window, when such an event stream is detected, the application will receive a CANCEL motion event to indicate this so applications can handle this accordingly by taking no action on the event until the finger is released.

int FLAG_KEEP_SCREEN_ON Window flag: as long as this window is visible to the user, keep the device's screen turned on and bright.
int FLAG_LAYOUT_INSET_DECOR Window flag: a special option only for use in combination with FLAG_LAYOUT_IN_SCREEN.
int FLAG_LAYOUT_IN_SCREEN Window flag: place the window within the entire screen, ignoring decorations around the border (a.k.a.
int FLAG_LAYOUT_NO_LIMITS Window flag: allow window to extend outside of the screen.
int FLAG_NOT_FOCUSABLE Window flag: this window won't ever get key input focus, so the user can not send key or other button events to it.
int FLAG_NOT_TOUCHABLE Window flag: this window can never receive touch events.
int FLAG_NOT_TOUCH_MODAL Window flag: Even when this window is focusable (its {@link #FLAG_NOT_FOCUSABLE is not set),
allow any pointer events outside of the window to be sent to the windows behind it.
int FLAG_SCALED Window flag: a special mode where the layout parameters are used to perform scaling of the surface when it is composited to the screen.
int FLAG_SECURE Window flag: don't allow screen shots while this window is displayed.
int FLAG_SHOW_WALLPAPER Window flag: ask that the system wallpaper be shown behind your window.
int FLAG_SHOW_WHEN_LOCKED Window flag: special flag to let windows be shown when the screen is locked.
int FLAG_SPLIT_TOUCH Window flag: when set the window will accept for touch events outside of its bounds to be sent to other windows that also support split touch. When this flag is not set, the first pointer that goes down determines the window to which all subsequent touches go until all pointers go up. When this flag is set, each pointer (not necessarily the first) that goes down determines the window to which all subsequent touches of that pointer will go until that pointer goes up thereby enabling touches with multiple pointers to be split across multiple windows
当该window在可以接受触摸屏情况下,让因在该window之外,而发送到后面的window的触摸屏可以支持split touch.
int FLAG_TOUCHABLE_WHEN_WAKING Window flag: When set, if the device is asleep when the touch screen is pressed, you will receive this first touch event.
int FLAG_TURN_SCREEN_ON Window flag: when set as a window is being added or made visible, once the window has been shown then the system will poke the power manager's user activity (as if the user had woken up the device) to turn the screen on.
int FLAG_WATCH_OUTSIDE_TOUCH Window flag: if you have set FLAG_NOT_TOUCH_MODAL, you can set this flag to receive a single special MotionEvent with the action MotionEvent.ACTION_OUTSIDE 
for touches that occur outside of your window.
int SOFT_INPUT_ADJUST_NOTHING Adjustment option for softInputMode: set to have a window not adjust for a shown input method.
int SOFT_INPUT_ADJUST_PAN Adjustment option for softInputMode: set to have a window pan when an input method is shown, so it doesn't need to deal with resizing but just panned by the framework to ensure the current input focus is visible.
int SOFT_INPUT_ADJUST_RESIZE Adjustment option for softInputMode: set to allow the window to be resized when an input method is shown, so that its contents are not covered by the input method.
int SOFT_INPUT_ADJUST_UNSPECIFIED Adjustment option for softInputMode: nothing specified.
int SOFT_INPUT_IS_FORWARD_NAVIGATION Bit for softInputMode: set when the user has navigated forward to the window.
int SOFT_INPUT_MASK_ADJUST Mask for softInputMode of the bits that determine the way that the window should be adjusted to accommodate the soft input window.
int SOFT_INPUT_MASK_STATE Mask for softInputMode of the bits that determine the desired visibility state of the soft input area for this window.
int SOFT_INPUT_MODE_CHANGED 用于表示softInputMode发生了变化。关于此的详细内容请看后文。
int SOFT_INPUT_STATE_ALWAYS_HIDDEN Visibility state for softInputMode:
please always hide any soft input area when this window receives focus.
int SOFT_INPUT_STATE_ALWAYS_VISIBLE Visibility state for softInputMode:
 please always make the soft input area visible when this window receives input focus.
int SOFT_INPUT_STATE_HIDDEN Visibility state for softInputMode:
please hide any soft input area when normally appropriate (when the user is navigating forward to your window).
int SOFT_INPUT_STATE_UNCHANGED Visibility state for softInputMode: please don't change the state of the soft input area.
int SOFT_INPUT_STATE_UNSPECIFIED Visibility state for softInputMode: no state has been specified.
int SOFT_INPUT_STATE_VISIBLE Visibility state for softInputMode: please show the soft input area when normally appropriate
(when the user is navigating forward to your window).
Window type系列
int TYPE_APPLICATION Window type: a normal application window.
int TYPE_APPLICATION_ATTACHED_DIALOG Window type: like TYPE_APPLICATION_PANEL, but layout of the window happens as that of a top-level window, not as a child of its container.
int TYPE_APPLICATION_MEDIA Window type: window for showing media (e.g.
int TYPE_APPLICATION_PANEL Window type: a panel on top of an application window.
int TYPE_APPLICATION_STARTING Window type: special application window that is displayed while the application is starting.
int TYPE_APPLICATION_SUB_PANEL Window type: a sub-panel on top of an application window.
int TYPE_BASE_APPLICATION Window type: an application window that serves as the "base" window of the overall application; all other application windows will appear on top of it.
int TYPE_CHANGED 表示window的类型发生了变化,关于此的详细内容请看后文。
int TYPE_INPUT_METHOD Window type: internal input methods windows, which appear above the normal UI.
int TYPE_INPUT_METHOD_DIALOG Window type: internal input methods dialog windows, which appear above the current input method window.
int TYPE_KEYGUARD Window type: keyguard window.
int TYPE_KEYGUARD_DIALOG Window type: dialogs that the keyguard shows
int TYPE_PHONE Window type: phone.
int TYPE_PRIORITY_PHONE Window type: priority phone UI, which needs to be displayed even if the keyguard is active.
int TYPE_SEARCH_BAR Window type: the search bar.
int TYPE_STATUS_BAR Window type: the status bar.
int TYPE_STATUS_BAR_PANEL Window type: panel that slides out from over the status bar
int TYPE_SYSTEM_ALERT Window type: system window, such as low power alert.
int TYPE_SYSTEM_DIALOG Window type: panel that slides out from the status bar
int TYPE_SYSTEM_ERROR Window type: internal system error windows, appear on top of everything they can.
int TYPE_SYSTEM_OVERLAY Window type: system overlay windows, which need to be displayed on top of everything else.
int TYPE_TOAST Window type: transient notifications.
int TYPE_WALLPAPER Window type: wallpaper window,
placed behind any window that wants to sit on top of the wallpaper.
window 的类型被分为了3大类:
Application windows (ranging from FIRST_APPLICATION_WINDOW to LAST_APPLICATION_WINDOW) are normal top-level application windows. For these types of windows, the token must be set to the token of the activity they are a part of (this will normally be done for you if token is null).
Sub-windows (ranging from FIRST_SUB_WINDOW to LAST_SUB_WINDOW) are associated with another top-level window. For these types of windows, the token must be the token of the window it is attached to.
System windows (ranging from FIRST_SYSTEM_WINDOW to LAST_SYSTEM_WINDOW) are special types of windows for use by the system for specific purposes. They should not normally be used by applications, and a special permission is required to use them.
int FIRST_APPLICATION_WINDOW Start of window types that represent normal application windows.
Constant Value: 1 (0x00000001)
int FIRST_SUB_WINDOW Start of types of sub-windows.
Constant Value: 1000 (0x000003e8)
int FIRST_SYSTEM_WINDOW Start of system-specific window types.
Constant Value: 2000 (0x000007d0)
int LAST_APPLICATION_WINDOW End of types of application windows.
Constant Value: 99 (0x00000063)
int LAST_SUB_WINDOW End of types of sub-windows.
Constant Value: 1999 (0x000007cf)
int LAST_SYSTEM_WINDOW End of types of system windows.
Constant Value: 2999 (0x00000bb7)


2011-08-07 08:08:54|  分类: Android基础 |  标签:windowmanager   |字号 订阅

float BRIGHTNESS_OVERRIDE_FULL Value for screenBrightness and buttonBrightness 
indicating that the screen or button backlight brightness should be set to the hightest value
when this window is in front.
float BRIGHTNESS_OVERRIDE_NONE Default value for screenBrightness and buttonBrightness indicating that the brightness value is not overridden for this window and normal brightness policy should be used.
float BRIGHTNESS_OVERRIDE_OFF Value for screenBrightness and buttonBrightness indicating that the screen or button backlight brightness should be set to the lowest value when this window is in front.
该系列主要用于 int copyFrom (WindowManager.LayoutParams o)函数中。
int ALPHA_CHANGED 用于表示成员变量alpha是否被改变
int ANIMATION_CHANGED 用于表示成员变量windowAnimations是否被改变
int DIM_AMOUNT_CHANGED 用于表示成员变量dimAmount是否被改变
int FLAGS_CHANGED 用于表示成员变量flags是否被改变
int LAYOUT_CHANGED 用于表示layout是否被改变.这里的layout是指以下变量所包含的信息:
width,height,x,y, verticalMargin,verticalWeight,horizontalMargin,horizontalWeight
int SCREEN_BRIGHTNESS_CHANGED 用于表示brightness是否被改变.
int SCREEN_ORIENTATION_CHANGED 用于表示成员变量screenOrientation是否被改变
int SOFT_INPUT_MODE_CHANGED 用于表示成员变量softInputMode是否被改变
int TITLE_CHANGED 用于表示成员变量title是否被改变
int TYPE_CHANGED 用于表示成员变量type是否被改变
int FORMAT_CHANGED Constant Value: 8 (0x00000008)
public int height Information about how tall the view wants to be.
public LayoutAnimationController.AnimationParameters layoutAnimationParameters Used to animate layouts.
public int width Information about how wide the view wants to be.
public static final Creator<WindowManager.LayoutParams> CREATOR  
public float alpha An alpha value to apply to this entire window.
public float buttonBrightness This can be used to override the standard behavior of the button and keyboard backlights.
public float dimAmount When FLAG_DIM_BEHIND is set, this is the amount of dimming to apply.
public int flags Various behavioral options/flags.
public int format The desired bitmap format.
public int gravity Placement of window within the screen as per Gravity.
public float horizontalMargin The horizontal margin, as a percentage of the container's width, between the container and the widget.
public float horizontalWeight Indicates how much of the extra space will be allocated horizontally to the view associated with these LayoutParams.
public int memoryType This field is deprecated. this is ignored
public String packageName Name of the package owning this window.
public float screenBrightness This can be used to override the user's preferred brightness of the screen.
public int screenOrientation Specific orientation value for a window.
public int softInputMode Desired operating mode for any soft input area.
public int systemUiVisibility Control the visibility of the status bar.
public IBinder token Identifier for this window.
public int type The general type of window.
public float verticalMargin The vertical margin, as a percentage of the container's height, between the container and the widget.
public float verticalWeight Indicates how much of the extra space will be allocated vertically to the view associated with these LayoutParams.
public int windowAnimations A style resource defining the animations to use for this window.
public int x X position for this window.
public int y Y position for this window.
ublic Methods
final int copyFrom(WindowManager.LayoutParams o)
String debug(String output)
Returns a String representation of this set of layout parameters.
int describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
final CharSequence getTitle()
static boolean mayUseInputMethod(int flags)
Given a particular set of window manager flags, determine whether such a window may be a target for an input method when it has focus.
final void setTitle(CharSequence title)
String toString()
Returns a string containing a concise, human-readable description of this object.
void writeToParcel(Parcel out, int parcelableFlags)
Flatten this object in to a Parcel.
posted @ 2012-12-12 09:36  淡泊名利  阅读(23224)  评论(1编辑  收藏  举报