Android getWindow().setFlags方法 設定窗體全屏點亮背景模糊 &&WindowManager.LayoutParams詳解
//設定窗體全屏
- getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
- WindowManager.LayoutParams.FLAG_FULLSCREEN);
//設定窗體始終點亮
- getWindow().setFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON,
- WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
//設定窗體背景模糊
-
getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND,
- WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
WindowManager.LayoutParams
extends ViewGroup.LayoutParamsimplements Parcelable WindowManager.LayoutParams 是 WindowManager 介面的巢狀類;它繼承於 ViewGroup.LayoutParams; 它用於向WindowManager描述Window的管理策略。 主要成員常量 Window flag系列
int | 用於表示flags發生了變化,關於此的詳細內容請看後文。 |
int |
Window flag: as long as this window is visible to the user, allow the lock screen to activate while the screen is on. 當該window對使用者可見的時候,允許鎖屏。 |
int | Window flag: invert the state of with respect to how this window interacts with the current method. |
int |
Window flag: blur everything behind this window. 讓該window後所有東西都模糊(blur) |
int |
Window flag: everything behind this window will be dimmed. 讓該window後所有的東西都成暗淡(dim) |
int |
Window flag: when set the window will cause the keyguard to be dismissed, only if it is not a secure lock keyguard. |
int |
Window flag: turn on dithering when compositing this window to the screen. 開啟抖動(dithering) |
int |
Window flag: Override {@link #FLAG_FULLSCREEN and force the screen decorations (such as status bar) to be shown. 恢復window非全屏顯示 |
int |
Window flag: Hide all screen decorations (e.g. 讓window進行全屏顯示 |
int |
Indicates whether this window should be hardware accelerated. 對該window進行硬體加速. 該flag必須在設定你的Activity或Dialog的Content View之前進行設定, 而且如果你在mainfest檔案中用Android:hardwareAccelerated開啟了該屬性的話,那麼你在程式中就不能再改變它。mainfest檔案中android:hardwareAccelerated屬性預設是開啟的("true")。 |
int | 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 |
Window flag: as long as this window is visible to the user, keep the device's screen turned on and bright. 當該window對使用者可見時,讓裝置螢幕處於高亮(bright)狀態。 |
int |
Window flag: place the window within the entire screen, ignoring decorations around the border (a.k.a. 讓window佔滿整個手機螢幕,不留任何邊界(border) |
int |
Window flag: allow window to extend outside of the screen. window大小不再不受手機螢幕大小限制,即window可能超出螢幕之外,這時部分內容在螢幕之外。 |
int |
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傳送按鍵事件及按鈕事件 |
int |
Window flag: this window can never receive touch events. 讓該window不接受觸控式螢幕事件 |
int |
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. |
int | 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 |
Window flag: don't allow screen shots while this window is displayed. 當該window在進行顯示的時候,不允許截圖。 |
int |
Window flag: ask that the system wallpaper be shown behind your window. 在該window後顯示系統的牆紙(wallpaper) |
int |
Window flag: special flag to let windows be shown when the screen is locked. 當鎖屏的時候,顯示該window. |
int |
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 |
Window flag: When set, if the device is asleep when the touch screen is pressed, you will receive this first touch event. 當手機處於睡眠狀態時,如果螢幕被按下,那麼該window將第一個收到到事件 |
int |
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. 當然window被顯示的時候,系統將把它當做一個使用者活動事件,以點亮手機螢幕。 |
int |
Window flag: if you have set ,
you can set this flag to receive a single special MotionEvent with the action for touches that occur outside of your window. 如果你設定了該flag,那麼在你FLAG_NOT_TOUNCH_MODAL的情況下,即使觸控式螢幕事件傳送在該window之外,其事件被髮送到了後面的window,那麼該window仍然將以MotionEvent.ACTION_OUTSIDE形式收到該觸控式螢幕事件 |
int |
Adjustment option for : set to have a window not adjust for a shown input method. |
|
int |
Adjustment option for : 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 |
Adjustment option for : 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 |
Bit for : set when the user has navigated forward to the window. |
|
int |
Mask for of the bits that determine the way that the window should be adjusted to accommodate the soft input window. SOFT_INPUT_ADJUST_NOTHING, SOFT_INPUT_ADJUST_PAN, SOFT_INPUT_ADJUST_RESIZE, SOFT_INPUT_ADJUST_UNSPECIFIED。用於描述軟鍵盤顯示的規則可以是 SOFT_INPUT_STATE_ALWAYS_HIDDEN, SOFT_INPUT_STATE_ALWAYS_VISIBLE,SOFT_INPUT_STATE_HIDDEN, SOFT_INPUT_STATE_VISIBLE, SOFT_INPUT_STATE_UNSPECIFIED之一 |
|
int |
Mask for of the bits that determine the desired visibility state of the soft input area for this window. |
|
int |
用於表示softInputMode發生了變化。關於此的詳細內容請看後文。 |
|
int |
Visibility state for : focus. |
|
int |
Visibility state for : receives input focus. |
|
int |
Visibility state for : the user is navigating forward to your window). |
|
int |
Visibility state for : please don't change the state of the soft input area. |
|
int |
Visibility state for : please show the soft input area when normally appropriate |
Window type系列 該系列主要用於表示window的型別。我們可以通過WindowManager.LayoutParams的type變數直接進行設定.
int |
Window type: a normal application window. 普通的應用程式window,token必須設定為Activity的token,以指出該視窗屬誰 |
int |
Window type: like ,
but layout of the window happens as that of a top-level window, not as a child of its container. 對話方塊。類似於面板視窗,繪製類似於頂層視窗,而不是宿主的子視窗。 |
int |
Window type: window for showing media (e.g. 媒體視窗,例如視訊。顯示於宿主視窗下層。 |
int |
Window type: a panel on top of an application window. 面板視窗,顯示於宿主視窗上層 |
int |
Window type: special application window that is displayed while the application is starting. 用於應用程式啟動時所顯示的視窗。應用本身不要使用這種型別。它用於讓系統顯示些資訊,直到應用程式可以開啟自己的視窗 |
int |
Window type: a sub-panel on top of an application window. 應用程式視窗的子面板。顯示於所有面板視窗的上層。(GUI的一般規律,越“子”越靠上) |
int |
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 | 表示window的型別發生了變化,關於此的詳細內容請看後文。 |
int |
Window type: internal input methods windows, which appear above the normal UI. 內部輸入法視窗,顯示於普通UI之上。應用程式可重新佈局以免被此視窗覆蓋 |
int |
Window type: internal input methods dialog windows, which appear above the current input method window. 內部輸入法對話方塊,顯示於當前輸入法視窗之上 |
int |
Window type: keyguard window. 鎖屏視窗 |
int |
Window type: dialogs that the keyguard shows 鎖屏時顯示的對話方塊 |
int |
Window type: phone. 電話視窗。它用於電話互動(特別是呼入)。它置於所有應用程式之上,狀態列之下。 |
int |
Window type: priority phone UI, which needs to be displayed even if the keyguard is active. 電話優先,當鎖屏時顯示。此視窗不能獲得輸入焦點,否則影響鎖屏。 |
int |
Window type: the search bar. 搜尋欄。只能有一個搜尋欄;它位於螢幕上方。 |
int |
Window type: the status bar. 狀態列型別的window。只能有一個狀態列window;它位於螢幕頂端,其他視窗都位於它下方。 |
int |
Window type: panel that slides out from over the status bar 狀態列的滑動面板 |
int |
Window type: system window, such as low power alert. 系統提示window,比如電池低的警告。它總是出現在應用程式視窗之上。 |
int |
Window type: panel that slides out from the status bar 系統對話方塊。(例如音量調節框) |
int |
Window type: internal system error windows, appear on top of everything they can. 系統內部錯誤提示,顯示於所有內容之上 |
int |
Window type: system overlay windows, which need to be displayed on top of everything else. 系統頂層視窗。顯示在其他一切內容之上。此視窗不能獲得輸入焦點,否則影響鎖屏。 |
int |
Window type: transient notifications. toast型別的window |
int |
Window type: wallpaper window, placed behind any window that wants to sit on top of the wallpaper. 用於牆紙的window |
int |
Start of window types that represent normal application windows. Constant Value: 1 (0x00000001) |
int |
Start of types of sub-windows. Constant Value: 1000 (0x000003e8) |
int |
Start of system-specific window types. Constant Value: 2000 (0x000007d0) |
int |
End of types of application windows. Constant Value: 99 (0x00000063) |
int |
End of types of sub-windows. Constant Value: 1999 (0x000007cf) |
int |
End of types of system windows. Constant Value: 2999 (0x00000bb7) |
float |
Value for and indicating that the screen or button backlight brightness should be set to the hightest value when this window is in front. 把brightness(screenBrightness/buttonBrightness)設定到最高值。 |
float |
Default value for and indicating
that the brightness value is not overridden for this window and normal brightness policy should be used. 不對brightness(screenBrightness/buttonBrightness)重新進行設定,採用預設的普通值。 |
float |
Value for and indicating
that the screen or button backlight brightness should be set to the lowest value when this window is in front. 把brightness(screenBrightness/buttonBrightness)設定到最低值。 |
int | 用於表示成員變數alpha是否被改變 |
int | 用於表示成員變數windowAnimations是否被改變 |
int | 用於表示成員變數flags是否被改變 |
int |
用於表示layout是否被改變.這裡的layout是指以下變數所包含的資訊: width,height,x,y, verticalMargin,verticalWeight,horizontalMargin,horizontalWeight |
int |
用於表示brightness是否被改變. 這裡的brightness是指以下變數對應的資訊:screenBrightness,buttonBrightness |
int | 用於表示成員變數title是否被改變 |
int | 用於表示成員變數type是否被改變 |
int |
Constant Value: 8 (0x00000008) 用於表示成員變數format是否被改變 |
public int | Information about how tall the view wants to be. | |
public int | width | Information about how wide the view wants to be. |
public float |