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


Java Window.setLayout方法代码示例

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


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

示例1: onResume

import android.view.Window; //导入方法依赖的package包/类
@Override
public void onResume() {
    super.onResume();
    Window window = getDialog().getWindow();
    if (window != null) {
        DisplayMetrics dm = new DisplayMetrics();
        getActivity().getWindowManager().getDefaultDisplay().getMetrics(dm);
        int height = dm.heightPixels;
        int width = dm.widthPixels;
        window.setLayout(width, height);
        window.setLayout((int) (width * 0.8), (int) (height * 0.9));
    }
}
 
开发者ID:Cleveroad,项目名称:AdaptiveTableLayout,代码行数:14,代码来源:SettingsDialog.java

示例2: LoadDialog

import android.view.Window; //导入方法依赖的package包/类
/**
 * the LoadDialog constructor
 *
 * @param ctx          Context
 * @param canNotCancel boolean
 * @param tipMsg       String
 */
public LoadDialog(final Context ctx, boolean canNotCancel, String tipMsg) {
    super(ctx);

    this.canNotCancel = canNotCancel;
    this.tipMsg = tipMsg;
    this.getContext().setTheme(android.R.style.Theme_InputMethod);
    setContentView(R.layout.layout_dialog_loading);

    if (!TextUtils.isEmpty(this.tipMsg)) {
        mShowMessage = (TextView) findViewById(R.id.show_message);
        mShowMessage.setText(this.tipMsg);
    }

    Window window = getWindow();
    WindowManager.LayoutParams attributesParams = window.getAttributes();
    attributesParams.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND;
    attributesParams.dimAmount = 0.5f;
    window.setAttributes(attributesParams);

    window.setLayout(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
}
 
开发者ID:zqHero,项目名称:rongyunDemo,代码行数:29,代码来源:LoadDialog.java

示例3: onCreate

import android.view.Window; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Window window = getWindow();
    if (window != null) {
        if (Build.VERSION.SDK_INT >= 21) {
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);

            window.setStatusBarColor(StyledAttributesHelper.getColor(getContext(), R.attr.colorPrimaryDark, 0));
        }
        window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);
        window.setBackgroundDrawable(null);
        window.setWindowAnimations(R.style.Animation_AppCompat_Dialog);
    }
}
 
开发者ID:MCMrARM,项目名称:revolution-irc,代码行数:18,代码来源:StorageLimitsDialog.java

示例4: onCreateView

import android.view.Window; //导入方法依赖的package包/类
/**
     * 使用   onCreateView 创建   对话框的样式  使用自定义视图
     */
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        getDialog().getWindow().setFlags(
                WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);

        /**
         * 先设置   无标题样式的  对话框
         */
        getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
        final Window window = getDialog().getWindow();
        View view = inflater.inflate(R.layout.dialog_webview_fragment,  ((ViewGroup) window.findViewById(android.R.id.content)), false);//需要用android.R.id.content这个view
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));//注意此处
        window.setLayout(-1, -2);//这2行,和上面的一样,注意顺序就行;
        webView = view.findViewById(R.id.webView);
        RelativeLayout azkRefreshLayout = view.findViewById(R.id.root_view);
        azkRefreshLayout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismissAllowingStateLoss();
            }
        });

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
//            http://blog.csdn.net/zhulin2609/article/details/51437821  基于webkit核心的webview端调试
            setWebContentsDebuggingEnabled(true);
        }

        initWebSettings(webView);

        getDialog().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager
                .LayoutParams.FLAG_ALT_FOCUSABLE_IM);
        getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);

        webView.loadUrl(Constant.ZKTEAM_XIAN_LIAO_ME_URL);
        return view;
    }
 
开发者ID:ZhuoKeTeam,项目名称:JueDiQiuSheng,代码行数:43,代码来源:WebViewDialogFragment.java

示例5: displayListViewDialog

import android.view.Window; //导入方法依赖的package包/类
private static void displayListViewDialog(@NonNull Context context, @NonNull String title, @NonNull ArrayList<String> list) {
    final android.app.Dialog dialog = new android.app.Dialog(context);

    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    dialog.setContentView(R.layout.dialog_listview);

    TextView titleView = dialog.findViewById(R.id.dialog_title_text_view);
    titleView.setText(title);

    com.rey.material.widget.Button closeButton = dialog.findViewById(R.id.dialog_button_close);
    closeButton.setOnClickListener(v -> dialog.dismiss());

    ListView listView = dialog.findViewById(R.id.dialog_list_view);
    listView.setAdapter(new ArrayAdapter<>(context, android.R.layout.simple_dropdown_item_1line, list));

    dialog.setCancelable(true);
    dialog.show();

    Window window = dialog.getWindow();
    if (window != null) {
        window.setLayout(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    }
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-AndroidApplication,代码行数:24,代码来源:MapContentBuilder.java

示例6: onCreate

import android.view.Window; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final Window window = getWindow();
    if (window == null) {
        return;
    }
    // 得到屏幕高度
    int screenHeight = getContext().getResources().getDisplayMetrics().heightPixels;

    // 得到状态栏的高度
    int statuesHeight = (int) Ui.dipToPx(getContext().getResources(), 75);

    int dialogHeight = screenHeight - statuesHeight;
    window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT,
            dialogHeight <= 0 ? ViewGroup.LayoutParams.MATCH_PARENT : dialogHeight);
}
 
开发者ID:FZZFVII,项目名称:pipe,代码行数:19,代码来源:GalleryFragment.java

示例7: onCreateView

import android.view.Window; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.folderchooser_dialog, null);

    Window window = getDialog().getWindow();
    window.requestFeature(Window.FEATURE_NO_TITLE);

    // retrieve display dimensions
    Rect displayRectangle = new Rect();
    window.getDecorView().getWindowVisibleDisplayFrame(displayRectangle);

    int w = (int) (displayRectangle.width() * 0.95);
    int h = (int) (displayRectangle.height() * 0.9);
    window.setLayout(w, h);

    WindowManager.LayoutParams params = window.getAttributes();
    window.setAttributes(params);

    return view;
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:21,代码来源:FileManagerDialog.java

示例8: onStart

import android.view.Window; //导入方法依赖的package包/类
@Override
public void onStart() {
    super.onStart();
    final Dialog dialog = getDialog();
    if (dialog != null) {
        final Window windowDialog = dialog.getWindow();
        if (windowDialog != null) {
            if (Utils.isLandscape(getActivity())) {
                final int width = ViewGroup.LayoutParams.MATCH_PARENT;
                final int height = ViewGroup.LayoutParams.MATCH_PARENT;
                windowDialog.setLayout(width, height);
            }
        }
    }
}
 
开发者ID:ttpho,项目名称:TimePicker,代码行数:16,代码来源:TimePickerDialog.java

示例9: setDialogSize

import android.view.Window; //导入方法依赖的package包/类
public static void setDialogSize(@NonNull Context context, @NonNull Dialog dialog) {
    int maxWidth = ResourceUtils.dimen(context, R.dimen.dialog_max_size);
    int padding = ResourceUtils.dimen(context, R.dimen.dialog_padding);
    int screenSize = DeviceUtils.getScreenWidth(context);
    if (maxWidth > screenSize - 2 * padding) {
        maxWidth = screenSize - 2 * padding;
    }
    Window window = dialog.getWindow();
    if (window != null) {
        window.setLayout(maxWidth, ViewGroup.LayoutParams.WRAP_CONTENT);
    }
}
 
开发者ID:XndroidDev,项目名称:Xndroid,代码行数:13,代码来源:BrowserDialog.java

示例10: onStart

import android.view.Window; //导入方法依赖的package包/类
@Override
public void onStart() {
    super.onStart();

    Dialog dialog = getDialog();
    if (dialog != null) {
        Window window = dialog.getWindow();
        if (window != null) {
            window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        }
    }
}
 
开发者ID:dhbw-timetable,项目名称:dhbw-timetable-android,代码行数:13,代码来源:InfoDialog.java

示例11: onCreateView

import android.view.Window; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.folderchooser_dialog, null);

    Window window = getDialog().getWindow();
    window.requestFeature(Window.FEATURE_NO_TITLE);
    //window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    //window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    //window.setGravity(Gravity.TOP | Gravity.LEFT);

    // retrieve display dimensions
    Rect displayRectangle = new Rect();
    window.getDecorView().getWindowVisibleDisplayFrame(displayRectangle);

    int w = (int) (displayRectangle.width() * 0.95);
    int h = (int) (displayRectangle.height() * 0.9);
    window.setLayout(w, h);

    // after that, setting values for x and y works "naturally"
    WindowManager.LayoutParams params = window.getAttributes();
    //params.x = 280;
    //params.y = 280;
    //params.height = 200;
    //params.dimAmount = 0f;


    window.setAttributes(params);


    return view;
}
 
开发者ID:victordiaz,项目名称:phonk,代码行数:32,代码来源:FolderChooserDialog.java

示例12: createDialogWithView

import android.view.Window; //导入方法依赖的package包/类
public Dialog createDialogWithView(View localView) {
    Dialog dialog = new Dialog(getContext(), R.style.jz_style_dialog_progress);
    dialog.setContentView(localView);
    Window window = dialog.getWindow();
    window.addFlags(Window.FEATURE_ACTION_BAR);
    window.addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL);
    window.addFlags(WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE);
    window.setLayout(-2, -2);
    WindowManager.LayoutParams localLayoutParams = window.getAttributes();
    localLayoutParams.gravity = Gravity.CENTER;
    window.setAttributes(localLayoutParams);
    return dialog;
}
 
开发者ID:monkeywiiu,项目名称:Discover,代码行数:14,代码来源:JZVideoPlayerStandard.java

示例13: onStart

import android.view.Window; //导入方法依赖的package包/类
@Override
public void onStart() {
    super.onStart();
    Window window = getDialog().getWindow();
    if (window != null)
        window.setLayout(WindowManager.LayoutParams.MATCH_PARENT, WindowManager.LayoutParams.MATCH_PARENT);
}
 
开发者ID:tranleduy2000,项目名称:text_converter,代码行数:8,代码来源:HelpDialog.java

示例14: onCreate

import android.view.Window; //导入方法依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.layout_dialog_bottom);
    Window window = getWindow();
    WindowManager.LayoutParams layoutParams = window.getAttributes();
    layoutParams.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND;
    layoutParams.dimAmount = 0.5f;
    window.setGravity(Gravity.BOTTOM);
    window.setAttributes(layoutParams);

    window.setLayout(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);

    photographBtn = (Button) findViewById(R.id.photographBtn);
    localPhotosBtn = (Button) findViewById(R.id.localPhotosBtn);
    cancelBtn = (Button) findViewById(R.id.cancelBtn);

    if (!TextUtils.isEmpty(confirmText)) {
        photographBtn.setText(confirmText);
    }
    if (!TextUtils.isEmpty(middleText)) {
        localPhotosBtn.setText(middleText);
    }
    if (!TextUtils.isEmpty(cancelText)) {
        cancelBtn.setText(cancelText);
    }

    cancelBtn.setOnClickListener(this);
    photographBtn.setOnClickListener(this);
    localPhotosBtn.setOnClickListener(this);
}
 
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:31,代码来源:BottomMenuDialog.java

示例15: displayDialog

import android.view.Window; //导入方法依赖的package包/类
private void displayDialog(final Dialog dialog) {
    dialog.setCancelable(true);
    dialog.show();
    Window window = dialog.getWindow();
    if (window != null) {
        window.setLayout(WindowManager.LayoutParams.FILL_PARENT, WindowManager.LayoutParams.WRAP_CONTENT);
    }
}
 
开发者ID:GuepardoApps,项目名称:LucaHome-AndroidApplication,代码行数:9,代码来源:DialogController.java


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