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


Java Window.setBackgroundDrawable方法代码示例

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


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

示例1: beginCameraDialog

import android.view.Window; //导入方法依赖的package包/类
final void beginCameraDialog() {
    DIALOG.show();
    final Window window = DIALOG.getWindow();
    if (window != null) {
        window.setContentView(R.layout.dialog_camera_panel);
        window.setGravity(Gravity.BOTTOM);
        window.setWindowAnimations(R.style.anim_panel_up_from_bottom);
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        //设置属性
        final WindowManager.LayoutParams params = window.getAttributes();
        params.width = WindowManager.LayoutParams.MATCH_PARENT;
        params.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND;
        window.setAttributes(params);

        window.findViewById(R.id.photodialog_btn_cancel).setOnClickListener(this);
        window.findViewById(R.id.photodialog_btn_take).setOnClickListener(this);
        window.findViewById(R.id.photodialog_btn_native).setOnClickListener(this);

    }
}
 
开发者ID:remerber,项目名称:FastEc,代码行数:21,代码来源:CameraHandler.java

示例2: initDialog

import android.view.Window; //导入方法依赖的package包/类
private void initDialog() {
    contentLayout = new FrameLayout(activity);
    contentLayout.setLayoutParams(new ViewGroup.LayoutParams(WRAP_CONTENT, WRAP_CONTENT));
    contentLayout.setFocusable(true);
    contentLayout.setFocusableInTouchMode(true);
    dialog = new Dialog(activity);
    dialog.setCanceledOnTouchOutside(true);//触摸屏幕取消窗体
    dialog.setCancelable(true);//按返回键取消窗体
    dialog.setOnKeyListener(this);
    dialog.setOnDismissListener(this);
    Window window = dialog.getWindow();
    if (window != null) {
        window.setGravity(Gravity.BOTTOM);
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        //AndroidRuntimeException: requestFeature() must be called before adding content
        window.requestFeature(Window.FEATURE_NO_TITLE);
        window.setContentView(contentLayout);
    }
    setSize(screenWidthPixels, WRAP_CONTENT);
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:21,代码来源:BasicPopup.java

示例3: onActivityCreate

import android.view.Window; //导入方法依赖的package包/类
public void onActivityCreate() {
    Window window = mActivity.getWindow();
    window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    window.getDecorView().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    mSwipeBackLayout = new SwipeBackLayout(mActivity);
    mSwipeBackLayout.addSwipeListener(new SwipeBackLayout.SwipeListener() {
        @Override
        public void onScrollStateChange(int state, float scrollPercent) {

        }

        @Override
        public void onEdgeTouch(int edgeFlag) {
            Utils.convertActivityToTranslucent(mActivity);
        }

        @Override
        public void onScrollOverThreshold() {

        }
    });
}
 
开发者ID:Zyj163,项目名称:yyox,代码行数:23,代码来源:SwipeBackActivityHelper.java

示例4: onStart

import android.view.Window; //导入方法依赖的package包/类
@Override
public void onStart() {
    super.onStart();
    Window window = getDialog().getWindow();
    if (window != null) {
        WindowManager.LayoutParams params = window.getAttributes();
        params.gravity = Gravity.BOTTOM;
        params.width = WindowManager.LayoutParams.MATCH_PARENT;
        window.setAttributes(params);
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    }
}
 
开发者ID:crazysunj,项目名称:Android-PickerDialog,代码行数:13,代码来源:PhoneOptionsPickerDialog.java

示例5: 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

示例6: init

import android.view.Window; //导入方法依赖的package包/类
private void init(Context context) {
    contentLayout = new FrameLayout(context);
    contentLayout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
    contentLayout.setFocusable(true);
    contentLayout.setFocusableInTouchMode(true);
    dialog = new android.app.Dialog(context);
    dialog.setCanceledOnTouchOutside(true);//触摸屏幕取消窗体
    dialog.setCancelable(true);//按返回键取消窗体
    Window window = dialog.getWindow();
    window.setGravity(Gravity.BOTTOM);//位于屏幕底部
    window.setWindowAnimations(R.style.Animation_Popup);
    window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    //android.util.AndroidRuntimeException: requestFeature() must be called before adding content
    window.requestFeature(Window.FEATURE_NO_TITLE);
    window.setContentView(contentLayout);
}
 
开发者ID:shenhuanet,项目名称:AndroidOpen,代码行数:17,代码来源:Popup.java

示例7: initView

import android.view.Window; //导入方法依赖的package包/类
protected void initView() {
    Window window = getWindow();
    window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    window.getDecorView().setBackgroundDrawable(null);
    setContentView(R.layout.sql_base_activity_layout);
    mContext = this;
    FrameLayout frameLayout = (FrameLayout) findViewById(R.id.fragment);
    if( frameLayout != null){
        frameLayout.addView(LayoutInflater.from(mContext).inflate(setViews(),null));
    }
    initIntent(getIntent());
    findViews();

    initToolBar();
    initFloatBtn();
}
 
开发者ID:WeiMei-Tian,项目名称:editor-sql,代码行数:17,代码来源:SqlBaseActivity.java

示例8: onCreateDialog

import android.view.Window; //导入方法依赖的package包/类
@NonNull @Override public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    dialog.setCancelable(false);
    setCancelable(false);
    Window window = dialog.getWindow();
    if (window != null) {
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        window.setDimAmount(0);
    }
    return dialog;
}
 
开发者ID:duyp,项目名称:mvvm-template,代码行数:12,代码来源:ProgressDialogFragment.java

示例9: onStart

import android.view.Window; //导入方法依赖的package包/类
@Override
public void onStart() {
    super.onStart();
    Window window = getDialog().getWindow();
    WindowManager.LayoutParams params = window.getAttributes();
    params.gravity = Gravity.BOTTOM;
    params.width = WindowManager.LayoutParams.MATCH_PARENT;
    window.setAttributes(params);
    window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
}
 
开发者ID:LingjuAI,项目名称:AssistantBySDK,代码行数:11,代码来源:BaseDialog.java

示例10: buildCenterSheet

import android.view.Window; //导入方法依赖的package包/类
protected BuildBean buildCenterSheet(BuildBean bean) {
    AlertDialog.Builder builder = new AlertDialog.Builder(bean.mContext);
    SheetHolder holder = new SheetHolder(bean.mContext);
    builder.setView(holder.rootView);
    AlertDialog dialog = builder.create();
    bean.alertDialog = dialog;
    if (bean.isVertical && !TextUtils.isEmpty(bean.bottomTxt)) {
        Window window = dialog.getWindow();
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    }
    holder.assingDatasAndEvents(bean.mContext, bean);
    return bean;
}
 
开发者ID:devzwy,项目名称:KUtils,代码行数:14,代码来源:Buildable.java

示例11: onCreateDialog

import android.view.Window; //导入方法依赖的package包/类
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Dialog dialog = super.onCreateDialog(savedInstanceState);
    Window window = dialog.getWindow();
    if (window == null) {
        Log.wtf(TAG, "getWindow() should not be null ever");
        return dialog;
    }
    window.getAttributes().windowAnimations = R.style.coach_mark_dialog_animation;
    window.setBackgroundDrawable(new ColorDrawable(ContextCompat.getColor(getContext(),
            R.color.coach_mark_transparent_color)));
    dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    return dialog;
}
 
开发者ID:myntra,项目名称:CoachMarks,代码行数:16,代码来源:PopUpCoachMark.java

示例12: onCreateView

import android.view.Window; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
    Window window = getDialog().getWindow();
    window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
    return createLayout();
}
 
开发者ID:devilist,项目名称:RecyclerWheelPicker,代码行数:9,代码来源:PasswordPicker.java

示例13: beginCameraDialog

import android.view.Window; //导入方法依赖的package包/类
/**
* 开启选择拍照还是从相册取照片的对话框
*/
final void beginCameraDialog(){
    DIALOG.show();
    //获取window,方便设置属性
    final Window window = DIALOG.getWindow();
    if(window != null){
        //设置dialog的自定义布局
        window.setContentView(R.layout.dialog_camera_panel);
        //设置dialog在底部
        window.setGravity(Gravity.BOTTOM);
        //设置动画
        window.setWindowAnimations(R.style.anim_panel_up_from_bottom);
        //设置透明背景
        window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        //获取属性
        final WindowManager.LayoutParams params = window.getAttributes();
        //宽度
        params.width = WindowManager.LayoutParams.MATCH_PARENT;
        //弹出对话框背景为灰色
        params.flags = WindowManager.LayoutParams.FLAG_DIM_BEHIND;
        params.dimAmount = 0.5f;
        window.setAttributes(params);
        //设置按钮点击事件
        window.findViewById(R.id.btn_dialog_cancel).setOnClickListener(this);
        window.findViewById(R.id.btn_dialog_take_photo).setOnClickListener(this);
        window.findViewById(R.id.btn_dialog_pick_photo).setOnClickListener(this);
    }

}
 
开发者ID:organizationAllink,项目名称:wzyx-android-user,代码行数:32,代码来源:CameraHandler.java

示例14: setLayout

import android.view.Window; //导入方法依赖的package包/类
private void setLayout() {
        Window window = getDialog().getWindow();
        window.setBackgroundDrawable(new ColorDrawable(0));
        window.getDecorView().setPadding(0, 0, 0, 0);
        window.setGravity(Gravity.BOTTOM);
//        window.setWindowAnimations(R.style.AnimBottom);
        WindowManager.LayoutParams lp = window.getAttributes();
        lp.width = ViewGroup.LayoutParams.MATCH_PARENT;
        lp.height = ViewGroup.LayoutParams.WRAP_CONTENT;
        lp.dimAmount = 0;
        window.setAttributes(lp);
    }
 
开发者ID:DyncKathline,项目名称:LiveGiftLayout,代码行数:13,代码来源:GiftDialogFrament.java

示例15: showDialogForView

import android.view.Window; //导入方法依赖的package包/类
private void showDialogForView(View view) {
    mDialog = new Dialog(mActivity) {
        @Override
        public void onWindowFocusChanged(boolean hasFocus) {
            super.onWindowFocusChanged(hasFocus);
            if (!hasFocus) super.dismiss();
        }
    };
    mDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mDialog.setCanceledOnTouchOutside(true);
    mDialog.addContentView(view,
            new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                                          LinearLayout.LayoutParams.MATCH_PARENT));
    mDialog.setOnDismissListener(new DialogInterface.OnDismissListener() {
        @Override
        public void onDismiss(DialogInterface dialog) {
            mItemSelectedCallback.onItemSelected("");
        }
    });

    Window window = mDialog.getWindow();
    if (!DeviceFormFactor.isTablet(mActivity)) {
        // On smaller screens, make the dialog fill the width of the screen,
        // and appear at the top.
        window.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
        window.setGravity(Gravity.TOP);
        window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT,
                         ViewGroup.LayoutParams.WRAP_CONTENT);
    }

    mDialog.show();
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:33,代码来源:ItemChooserDialog.java


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