android.view.WindowManager.LayoutParams#MATCH_PARENT源码实例Demo

下面列出了android.view.WindowManager.LayoutParams#MATCH_PARENT 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Noyze   文件: StatusBarVolumePanel.java
@Override public WindowManager.LayoutParams getWindowLayoutParams() {
	int flags = (LayoutParams.FLAG_NOT_FOCUSABLE		|
                    LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH  |
                    LayoutParams.FLAG_NOT_TOUCH_MODAL      |
                    LayoutParams.FLAG_LAYOUT_INSET_DECOR   |
			     LayoutParams.FLAG_LAYOUT_IN_SCREEN		|
			     LayoutParams.FLAG_SHOW_WHEN_LOCKED	    );
	LayoutParams WPARAMS = new WindowManager.LayoutParams(
		LayoutParams.MATCH_PARENT, mStatusBarHeight, 0, 0,
		LayoutParams.TYPE_SYSTEM_ERROR, flags, PixelFormat.TRANSLUCENT);
	WPARAMS.windowAnimations = android.R.style.Animation_Dialog;
	WPARAMS.packageName = getContext().getPackageName();
	WPARAMS.setTitle(TAG);
       WPARAMS.rotationAnimation = LayoutParams.ROTATION_ANIMATION_JUMPCUT;
	WPARAMS.gravity = (Gravity.FILL_HORIZONTAL | Gravity.TOP);
	WPARAMS.screenBrightness = WPARAMS.buttonBrightness = LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
	return WPARAMS;
}
 
源代码2 项目: Noyze   文件: StatusBarVolumePanel.java
@Override public WindowManager.LayoutParams getWindowLayoutParams() {
	int flags = (LayoutParams.FLAG_NOT_FOCUSABLE		|
                    LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH  |
                    LayoutParams.FLAG_NOT_TOUCH_MODAL      |
                    LayoutParams.FLAG_LAYOUT_INSET_DECOR   |
			     LayoutParams.FLAG_LAYOUT_IN_SCREEN		|
			     LayoutParams.FLAG_SHOW_WHEN_LOCKED	    );
	LayoutParams WPARAMS = new WindowManager.LayoutParams(
		LayoutParams.MATCH_PARENT, mStatusBarHeight, 0, 0,
		LayoutParams.TYPE_SYSTEM_ERROR, flags, PixelFormat.TRANSLUCENT);
	WPARAMS.windowAnimations = android.R.style.Animation_Dialog;
	WPARAMS.packageName = getContext().getPackageName();
	WPARAMS.setTitle(TAG);
       WPARAMS.rotationAnimation = LayoutParams.ROTATION_ANIMATION_JUMPCUT;
	WPARAMS.gravity = (Gravity.FILL_HORIZONTAL | Gravity.TOP);
	WPARAMS.screenBrightness = WPARAMS.buttonBrightness = LayoutParams.BRIGHTNESS_OVERRIDE_NONE;
	return WPARAMS;
}
 
源代码3 项目: WayHoo   文件: SystemUtils.java
/**
 * 获取一个自定义风格的Dialog
 * 
 * @param activity
 *            上下文对象
 * @param style
 *            风格
 * @param customView
 *            自定义view
 * @return dialog
 */
public static Dialog getCustomeDialog(Activity activity, int style,
		View customView) {
	Dialog dialog = new Dialog(activity, style);
	dialog.setCancelable(false);
	dialog.setCanceledOnTouchOutside(false);
	dialog.setContentView(customView);
	Window window = dialog.getWindow();
	WindowManager.LayoutParams lp = window.getAttributes();
	lp.width = LayoutParams.MATCH_PARENT;
	lp.height = LayoutParams.MATCH_PARENT;
	lp.x = 0;
	lp.y = 0;
	window.setAttributes(lp);
	return dialog;
}
 
源代码4 项目: RePlugin-GameSdk   文件: FunFloatingTool.java
private static void updateLayout(Context context, boolean isLeft) {
	android.widget.LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(
			LayoutParams.MATCH_PARENT, HWUtils.dip2px(context, 50));
	relativeLayout.removeAllViews();
	linearLayout.removeAllViews();
	linearLayout.setGravity(Gravity.TOP);
	linearLayout.setWeightSum(1);

	if (isLeft) {
		leftLayoutParams.leftMargin = HWUtils.dip2px(context, 10);
		leftLayoutParams.rightMargin = HWUtils.dip2px(context, 15);

		rightLayoutParams.leftMargin = HWUtils.dip2px(context, 0);
		rightLayoutParams.rightMargin = HWUtils.dip2px(context, 15);
		linearLayout.addView(hideBtn, leftLayoutParams);
		// linearLayout.addView(userBtn, centerLayoutParams);
		linearLayout.addView(userBtn, rightLayoutParams);

		relativeLayout.addView(floatButton, layoutParams);
		relativeLayout.addView(linearLayout, layoutParams);
	} else {
		leftLayoutParams.leftMargin = HWUtils.dip2px(context, 15);
		leftLayoutParams.rightMargin = HWUtils.dip2px(context, 0);

		rightLayoutParams.rightMargin = HWUtils.dip2px(context, 10);
		rightLayoutParams.leftMargin = HWUtils.dip2px(context, 15);
		linearLayout.addView(userBtn, leftLayoutParams);
		// linearLayout.addView(userBtn, centerLayoutParams);
		linearLayout.addView(hideBtn, rightLayoutParams);

		relativeLayout.addView(linearLayout, layoutParams);
		relativeLayout.addView(floatButton, layoutParams);

	}
}
 
源代码5 项目: AssistantBySDK   文件: NaviVoiceInputDialog.java
@Override
public void show() {
    Window dialogWindow = getWindow();
    LayoutParams lp = dialogWindow.getAttributes();
    lp.width = LayoutParams.MATCH_PARENT;
    lp.height = LayoutParams.MATCH_PARENT;
    /*WindowManager m = context.getWindowManager();
    Display d = m.getDefaultDisplay(); // 获取屏幕宽、高用
    lp.width = d.getWidth();*/
    dialogWindow.setAttributes(lp);
    EventBus.getDefault().register(this);
    super.show();
}
 
源代码6 项目: o2oa   文件: EasyAlertDialog.java
public EasyAlertDialog(Context context, int resourceId, int style) {
    super(context, style);
    this.context = context;
    if (-1 != resourceId) {
        setContentView(resourceId);
        this.resourceId = resourceId;
    }
    WindowManager.LayoutParams Params = getWindow().getAttributes();
    Params.width = LayoutParams.MATCH_PARENT;
    Params.height = LayoutParams.MATCH_PARENT;
    getWindow().setAttributes((android.view.WindowManager.LayoutParams) Params);
}
 
源代码7 项目: BigApp_Discuz_Android   文件: LockLayer.java
private void init() {
	isLocked = false;
	mWindowManager = mActivty.getWindowManager();
	mLockViewLayoutParams = new LayoutParams();
	mLockViewLayoutParams.width = LayoutParams.MATCH_PARENT;
	mLockViewLayoutParams.height = LayoutParams.MATCH_PARENT;
	// 实现关键
	mLockViewLayoutParams.type = LayoutParams.TYPE_SYSTEM_ERROR;
	// apktool value,这个值具体是哪个变量还请网友帮忙
	mLockViewLayoutParams.flags = 1280;
}
 
源代码8 项目: Noyze   文件: PopupDialog.java
protected void updateDimens() {
	final int[] wDims = getWindowDimensions();
	LayoutParams wParams = getWindowParams();
	if (mFullscreen) {
		wParams.width = wParams.height = LayoutParams.MATCH_PARENT;
	} else {
		wParams.width = ((3 * wDims[0]) / 4);
		wParams.height = ((3 * wDims[1]) / 4);
	}
}
 
源代码9 项目: NIM_Android_UIKit   文件: EasyAlertDialog.java
public EasyAlertDialog(Context context, int resourceId, int style) {
    super(context, style);
    this.context = context;
    if (-1 != resourceId) {
        setContentView(resourceId);
        this.resourceId = resourceId;
    }
    WindowManager.LayoutParams Params = getWindow().getAttributes();
    Params.width = LayoutParams.MATCH_PARENT;
    Params.height = LayoutParams.MATCH_PARENT;
    getWindow().setAttributes((android.view.WindowManager.LayoutParams) Params);
}
 
源代码10 项目: NIM_Android_UIKit   文件: EasyEditDialog.java
public EasyEditDialog(Context context, int resourceId, int style) {
    super(context, style);
    mMaxEditTextLength = 16;
    if (-1 != resourceId) {
        setContentView(resourceId);
        this.mResourceId = resourceId;
    }
    LayoutParams Params = getWindow().getAttributes();
    Params.width = LayoutParams.MATCH_PARENT;
    Params.height = LayoutParams.MATCH_PARENT;
    getWindow().setAttributes(Params);
}
 
源代码11 项目: Noyze   文件: PopupDialog.java
protected void updateDimens() {
	final int[] wDims = getWindowDimensions();
	LayoutParams wParams = getWindowParams();
	if (mFullscreen) {
		wParams.width = wParams.height = LayoutParams.MATCH_PARENT;
	} else {
		wParams.width = ((3 * wDims[0]) / 4);
		wParams.height = ((3 * wDims[1]) / 4);
	}
}
 
源代码12 项目: WayHoo   文件: SystemUtils.java
public static Dialog getCustomeDialog(Activity activity, int style,
		int customView) {
	Dialog dialog = new Dialog(activity, style);
	dialog.setCancelable(false);
	dialog.setCanceledOnTouchOutside(false);
	dialog.setContentView(customView);
	Window window = dialog.getWindow();
	WindowManager.LayoutParams lp = window.getAttributes();
	lp.width = LayoutParams.MATCH_PARENT;
	lp.height = LayoutParams.MATCH_PARENT;
	lp.x = 0;
	lp.y = 0;
	window.setAttributes(lp);
	return dialog;
}
 
源代码13 项目: connectivity-samples   文件: JUIHelper.java
public PopupWindow createPopupWindow(final NativeActivity act) {
    // Check manifest settings if the activity wouldn't be destroyed when
    // the device orientation changes
    try {
        ActivityInfo info = act.getPackageManager().getActivityInfo(
                act.getComponentName(), 0);
        if ((info.configChanges & ActivityInfo.CONFIG_ORIENTATION) == 0
                || (info.configChanges & ActivityInfo.CONFIG_SCREEN_SIZE) == 0) {
            Log.i("NDKHelper",
                    "Activity does not have android:configChanges='orientation|screenSize' attributes in AndroidManifest.xml.");
        }
    } catch (NameNotFoundException e) {
      Log.e("NDKHelper", "Failed to find ActivityName");
    }

    activity_ = act;
    // activity.setTheme(android.R.style.Theme_DeviceDefault);

    final PopupWindow popupWindow = new PopupWindow(
            LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    activity_.runOnUiThread(new Runnable() {
        @Override
        public void run() {
            Window window = activity_.getWindow();
            if( window != null )
            {
                View decorView = window.getDecorView();
                if( decorView == null )
                {
                    // Put dummy layout to NativeActivity
                    LinearLayout mainLayout = new LinearLayout(activity_);
                    MarginLayoutParams params = new MarginLayoutParams(
                            LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
                    params.setMargins(0, 0, 0, 0);
                    activity_.setContentView(mainLayout, params);
                    decorView = mainLayout;
                }

                // Setup relative layout
                JUIRelativeLayout_ = new RelativeLayout(activity_);
                popupWindow.setContentView(JUIRelativeLayout_);

                // Show our UI over NativeActivity window
                popupWindow.showAtLocation(decorView, Gravity.TOP
                        | Gravity.START, 0, 0);
                popupWindow.setTouchable(false);
                popupWindow.update();
            }
        }
    });
    return popupWindow;
}