Java Code Examples for android.view.WindowManager.LayoutParams#MATCH_PARENT

The following examples show how to use android.view.WindowManager.LayoutParams#MATCH_PARENT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StatusBarVolumePanel.java    From Noyze with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example 2
Source File: StatusBarVolumePanel.java    From Noyze with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example 3
Source File: SystemUtils.java    From WayHoo with Apache License 2.0 6 votes vote down vote up
/**
 * 获取一个自定义风格的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;
}
 
Example 4
Source File: FunFloatingTool.java    From RePlugin-GameSdk with Apache License 2.0 5 votes vote down vote up
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);

	}
}
 
Example 5
Source File: NaviVoiceInputDialog.java    From AssistantBySDK with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example 6
Source File: EasyAlertDialog.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
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);
}
 
Example 7
Source File: LockLayer.java    From BigApp_Discuz_Android with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 8
Source File: PopupDialog.java    From Noyze with Apache License 2.0 5 votes vote down vote up
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);
	}
}
 
Example 9
Source File: EasyAlertDialog.java    From NIM_Android_UIKit with MIT License 5 votes vote down vote up
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);
}
 
Example 10
Source File: EasyEditDialog.java    From NIM_Android_UIKit with MIT License 5 votes vote down vote up
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);
}
 
Example 11
Source File: PopupDialog.java    From Noyze with Apache License 2.0 5 votes vote down vote up
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);
	}
}
 
Example 12
Source File: SystemUtils.java    From WayHoo with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example 13
Source File: JUIHelper.java    From connectivity-samples with Apache License 2.0 4 votes vote down vote up
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;
}