WindowManager中的LayoutParams

本文大概介绍WindowManager中的LayoutParams主要参数及相关设置,仅供参考。

public static class

WindowManager.LayoutParams

extends ViewGroup.LayoutParams
implements Parcelable
java.lang.Object
   ? 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();
 winParams.flags=winParams.flags|WindowManager.LayoutParams.FLAG_FULLSCREEN
 或
 window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
 或
 window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); 
 取消全屏
 Window window = getWindow(); 
 winParams.flags=winParams.flags&~WindowManager.LayoutParams.FLAG_FULLSCREEN;
 或
 window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
 或
window.setFlags(0, WindowManager.LayoutParams.FLAG_FULLSCREEN);
所有Window flag如下:




softInputMode系列
该系列主要用于表示softInputMode,我们可以通过WindowManager.LayoutParams的softInputMode变量直接进行设置。softInputMode只能是一个显示软键盘时的window调整方式bite与一个控制软键盘显示状态的bite的组合。
显示软键盘时的window调整方式可以是SOFT_INPUT_ADJUST_NOTHINGSOFT_INPUT_ADJUST_PAN
SOFT_INPUT_ADJUST_RESIZESOFT_INPUT_ADJUST_UNSPECIFIED之一。
用于描述软键盘显示的规则可以是SOFT_INPUT_STATE_ALWAYS_HIDDENSOFT_INPUT_STATE_ALWAYS_VISIBLE
SOFT_INPUT_STATE_HIDDENSOFT_INPUT_STATE_VISIBLESOFT_INPUT_STATE_UNSPECIFIED之一
关于softInputMode的更多知识请参考软件盘的开关
所有的softInputMode系列常量如下:



Window type系列
该系列主要用于表示window的类型。我们可以通过WindowManager.LayoutParamstype变量直接进行设置.



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.
系统专门定义FIRST_APPLICATION_WINDOW , LAST_APPLICATION_WINDOW,FIRST_SUB_WINDOWLAST_SUB_WINDOW,
FIRST_SYSTEM_WINDOW,LAST_SYSTEM_WINDOW 以表示window的3大类型的类型的取值的范围。



http://blog.csdn.net/hudashi/article/details/7060882 




  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值