天天看點

WindowManager.LayoutParams(下)

本文參照自: http://developer.android.com/reference/android/view/WindowManager.LayoutParams.html BRIGHTNESS系列 該系列主要用于設定window的 brightness ( screenBrightness / buttonBrightness )。 我們可以通過 WindowManager.LayoutParams 的 screenBrightness / buttonBrightness 變量直接進行設定。 其中 screenBrightness 表示螢幕的b rightness ,而 buttonBrightness 表示一般按鍵和鍵盤按鍵的 brightness

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.

把brightness(screenBrightness/buttonBrightness)設定到最高值。

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.

不對brightness(screenBrightness/buttonBrightness)重新進行設定,采用預設的普通值。

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.

把brightness(screenBrightness/buttonBrightness)設定到最低值。

changed系列 該系列主要用于  int copyFrom (WindowManager.LayoutParams o)函數中。 在函數中,首先将用參數中傳入的 WindowManager.LayoutParams的資訊複制到本 WindowManager.LayoutParams 中,然後傳回一個整數,以bite形式表示調用該函數後 WindowManager.LayoutParams的哪些資訊發送了變化

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是否被改變.

這裡的brightness是指以下變量對應的資訊:screenBrightness,buttonBrightness

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)

用于表示成員變量format是否被改變

成員變量 繼承于 ViewGroup.LayoutParams 的成員變量

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.

結束!

繼續閱讀