当前位置: 首页>>代码示例>>Java>>正文


Java FrameLayout.setFitsSystemWindows方法代码示例

本文整理汇总了Java中android.widget.FrameLayout.setFitsSystemWindows方法的典型用法代码示例。如果您正苦于以下问题:Java FrameLayout.setFitsSystemWindows方法的具体用法?Java FrameLayout.setFitsSystemWindows怎么用?Java FrameLayout.setFitsSystemWindows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.FrameLayout的用法示例。


在下文中一共展示了FrameLayout.setFitsSystemWindows方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getContentView

import android.widget.FrameLayout; //导入方法依赖的package包/类
/**
 * Returns the view that will be the root view of the dialog. We are wrapping this in a
 * FrameLayout because this is the system's way of notifying us that the dialog size has changed.
 * This has the pleasant side-effect of us not having to preface all Modals with
 * "top: statusBarHeight", since that margin will be included in the FrameLayout.
 */
private View getContentView() {
  FrameLayout frameLayout = new FrameLayout(getContext());
  frameLayout.addView(mHostView);
  frameLayout.setFitsSystemWindows(true);
  return frameLayout;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:13,代码来源:ReactModalHostView.java

示例2: setParentActivity

import android.widget.FrameLayout; //导入方法依赖的package包/类
public void setParentActivity(Activity activity) {
    if (parentActivity == activity) {
        return;
    }
    parentActivity = activity;

    windowView = new FrameLayout(activity);
    windowView.setFocusable(true);
    windowView.setFocusableInTouchMode(true);
    if (Build.VERSION.SDK_INT >= 23) {
        windowView.setFitsSystemWindows(true);
    }

    containerView = new FrameLayoutDrawer(activity);
    containerView.setFocusable(false);
    windowView.addView(containerView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT, Gravity.TOP | Gravity.LEFT));
    containerView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_POINTER_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
                close();
            }
            return true;
        }
    });

    windowLayoutParams = new WindowManager.LayoutParams();
    windowLayoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;
    windowLayoutParams.format = PixelFormat.TRANSLUCENT;
    windowLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
    windowLayoutParams.gravity = Gravity.TOP;
    windowLayoutParams.type = WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
    if (Build.VERSION.SDK_INT >= 21) {
        windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS;
    } else {
        windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
    }
    centerImage.setAspectFit(true);
    centerImage.setInvalidateAll(true);
    centerImage.setParentView(containerView);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:42,代码来源:StickerPreviewViewer.java

示例3: setParentActivity

import android.widget.FrameLayout; //导入方法依赖的package包/类
public void setParentActivity(Activity activity) {
    if (parentActivity == activity) {
        return;
    }
    parentActivity = activity;

    windowView = new FrameLayout(activity);
    windowView.setBackgroundColor(0xff000000);
    windowView.setFocusable(true);
    windowView.setFocusableInTouchMode(true);
    if (Build.VERSION.SDK_INT >= 23) {
        windowView.setFitsSystemWindows(true);
    }

    containerView = new FrameLayoutDrawer(activity);
    containerView.setFocusable(false);
    windowView.addView(containerView);
    FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams)containerView.getLayoutParams();
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
    containerView.setLayoutParams(layoutParams);
    containerView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_POINTER_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
                closePhoto();
            }
            return true;
        }
    });

    secretDeleteTimer = new SecretDeleteTimer(activity);
    containerView.addView(secretDeleteTimer);
    layoutParams = (FrameLayout.LayoutParams)secretDeleteTimer.getLayoutParams();
    layoutParams.gravity = Gravity.TOP | Gravity.RIGHT;
    layoutParams.width = AndroidUtilities.dp(100);
    layoutParams.height = AndroidUtilities.dp(32);
    layoutParams.rightMargin = AndroidUtilities.dp(19);
    layoutParams.topMargin = AndroidUtilities.dp(19);
    secretDeleteTimer.setLayoutParams(layoutParams);

    windowLayoutParams = new WindowManager.LayoutParams();
    windowLayoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;
    windowLayoutParams.format = PixelFormat.TRANSLUCENT;
    windowLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
    windowLayoutParams.gravity = Gravity.TOP;
    windowLayoutParams.type = WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
    windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;

    centerImage.setParentView(containerView);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:53,代码来源:SecretPhotoViewer.java

示例4: setParentActivity

import android.widget.FrameLayout; //导入方法依赖的package包/类
public void setParentActivity(Activity activity) {
    if (parentActivity == activity) {
        return;
    }
    parentActivity = activity;

    windowView = new FrameLayout(activity);
    windowView.setBackgroundColor(0xff000000);
    windowView.setFocusable(true);
    windowView.setFocusableInTouchMode(true);
    if (Build.VERSION.SDK_INT >= 23) {
        windowView.setFitsSystemWindows(true); //TODO ?
    }

    containerView = new FrameLayoutDrawer(activity);
    containerView.setFocusable(false);
    windowView.addView(containerView);
    FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams)containerView.getLayoutParams();
    layoutParams.width = LayoutHelper.MATCH_PARENT;
    layoutParams.height = LayoutHelper.MATCH_PARENT;
    layoutParams.gravity = Gravity.TOP | Gravity.LEFT;
    containerView.setLayoutParams(layoutParams);
    containerView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (event.getAction() == MotionEvent.ACTION_UP || event.getAction() == MotionEvent.ACTION_POINTER_UP || event.getAction() == MotionEvent.ACTION_CANCEL) {
                closePhoto();
            }
            return true;
        }
    });

    secretDeleteTimer = new SecretDeleteTimer(activity);
    containerView.addView(secretDeleteTimer);
    layoutParams = (FrameLayout.LayoutParams)secretDeleteTimer.getLayoutParams();
    layoutParams.gravity = Gravity.TOP | Gravity.RIGHT;
    layoutParams.width = AndroidUtilities.dp(100);
    layoutParams.height = AndroidUtilities.dp(32);
    layoutParams.rightMargin = AndroidUtilities.dp(19);
    layoutParams.topMargin = AndroidUtilities.dp(19);
    secretDeleteTimer.setLayoutParams(layoutParams);

    windowLayoutParams = new WindowManager.LayoutParams();
    windowLayoutParams.height = WindowManager.LayoutParams.MATCH_PARENT;
    windowLayoutParams.format = PixelFormat.TRANSLUCENT;
    windowLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
    windowLayoutParams.gravity = Gravity.TOP;
    windowLayoutParams.type = WindowManager.LayoutParams.LAST_APPLICATION_WINDOW;
    windowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;

    centerImage.setParentView(containerView);
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:53,代码来源:SecretPhotoViewer.java


注:本文中的android.widget.FrameLayout.setFitsSystemWindows方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。