WindowManager.LayoutParams

原文出处:http://www.ccbu.cc/android/windowmanager-layoutparams

WindowManager.LayoutParams 是 WindowManager 接口的嵌套类;它继承于 ViewGroup.LayoutParams; 它用于向WindowManager描述Window的管理策略。

定义

public static class WindowManager.LayoutParams 
extends ViewGroup.LayoutParams implements Parcelable

继承关系

java.lang.Object
   |-Android.view.ViewGroup.LayoutParams
       |-android.view.WindowManager.LayoutParams

继承来的属性与常量

从 ViewManager.LayoutParams 继承来的属性:

  • android:layout_height Specifies the basic height of the view.
  • android:layout_width Specifies the basic width of the view.

从 ViewManager.LayoutParams继承的常量:

  • FILL_PARENT
  • WRAP_CONTENT
  • MATCH_PARENT

两个变量:

  • width
  • height

属性及可用的常量定义

flag 说明
FLAGS_CHANGED 用于表示flags发生了变化,关于此的详细内容请看后文。
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.
当该window对用户可见的时候,允许锁屏。
FLAG_ALT_FOCUSABLE_IM Window flag: invert the state of FLAG_NOT_FOCUSABLE with respect to
how this window interacts with the current method.
FLAG_BLUR_BEHIND Window flag: blur everything behind this window.
让该window后所有东西都模糊(blur)
FLAG_DIM_BEHIND Window flag: everything behind this window will be dimmed.
让该window后所有的东西都成暗淡(dim)
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.
FLAG_DITHER Window flag: turn on dithering when compositing this window to the screen.
开启抖动(dithering)
FLAG_FORCE_NOT_FULLSCREEN Window flag: Override {@link #FLAG_FULLSCREEN and force the screen
decorations (such as status bar) to be shown.恢复window非全屏显示
FLAG_FULLSCREEN Window flag: Hide all screen decorations (e.g.让window进行全屏显示
FLAG_HARDWARE_ACCELERATED Indicates whether this window should be hardware accelerated.
对该window进行硬件加速.该flag必须在设置你的Activity或Dialog的
Content View之前进行设置,而且如果你在mainfest文件中用
Android:hardwareAccelerated开启了该属性的话,那么你在程序中就不能再
改变它。mainfest文件中android:hardwareAccelerated属性默认是开启的("true")。
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.
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.
当该window对用户可见时,让设备屏幕处于高亮(bright)状态。
FLAG_LAYOUT_INSET_DECOR Window flag: a special option only for use in combination with
FLAG_LAYOUT_IN_SCREEN.
FLAG_LAYOUT_IN_SCREEN Window flag: place the window within the entire screen, ignoring decorations
around the border (a.k.a.让window占满整个手机屏幕,不留任何边界(border)
FLAG_LAYOUT_NO_LIMITS Window flag: allow window to extend outside of the screen.
window大小不再不受手机屏幕大小限制,即window可能超出屏幕之外,
这时部分内容在屏幕之外。
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.
让window不能获得焦点,这样用户快就不能向该window发送按键事件及按钮事件
FLAG_NOT_TOUCHABLE Window flag: this window can never receive touch events.
让该window不接受触摸屏事件
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.
即使在该window在可获得焦点情况下,
仍然把该window之外的任何event发送到该window之后的其他window.
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.
FLAG_SECURE Window flag: don't allow screen shots while this window is displayed.
当该window在进行显示的时候,不允许截屏。
FLAG_SHOW_WALLPAPER Window flag: ask that the system wallpaper be shown behind your window.
在该window后显示系统的墙纸(wallpaper)
FLAG_SHOW_WHEN_LOCKED Window flag: special flag to let windows be shown when the screen is locked.
当锁屏的时候,显示该window.
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
windowto 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 goesup thereby enabling touches with multiple pointers to be
split across multiple windows当该window在可以接受触摸屏情况下,
让因在该window之外,而发送到后面的window的触摸屏可以支持split touch.
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.当手机处于睡眠状态时,
如果屏幕被按下,那么该window将第一个收到到事件
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 a
ctivity (as if the user had woken up the device) to turn the screen on.当然
window被显示的时候,系统将把它当做一个用户活动事件,以点亮手机屏幕。
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.
如果你设置了该flag,那么在你FLAG_NOT_TOUNCH_MODAL的情况下,
即使触摸屏事件发送在该window之外,其事件被发送到了后面的window,
那么该window仍然将以MotionEvent.ACTION_OUTSIDE形式收到该触摸屏事件
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 194,670评论 5 460
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 81,928评论 2 371
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 141,926评论 0 320
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 52,238评论 1 263
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 61,112评论 4 356
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 46,138评论 1 272
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 36,545评论 3 381
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 35,232评论 0 253
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 39,496评论 1 290
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 34,596评论 2 310
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 36,369评论 1 326
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 32,226评论 3 313
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 37,600评论 3 299
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 28,906评论 0 17
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 30,185评论 1 250
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 41,516评论 2 341
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 40,721评论 2 335

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,258评论 0 10
  • The Inner Game of Tennis W Timothy Gallwey Jonathan Cape ...
    网事_79a3阅读 11,505评论 2 19
  • 前天和先生走在路上,忽然看到一棵小松树,树干上有捆绑的绳子,绳子深深的陷进了树干里,形成了一圈凹沟。先生看到这个情...
    方圆fg阅读 822评论 0 5
  • 今天是套利工具昨日手动建仓之后正式进行自动交易的第一天,结果在9点25分就完成了全部的两次4笔交易,分别套利千分之...
    资本是个球阅读 104评论 0 0
  • 不似前两次的人工降雪,仿佛是要回馈给北方冬天一个迟到的礼物,老天爷是真真正正的下了多半天的大雪。从轻轻飘洒到北风裹...
    心间明月阅读 140评论 0 1