美文网首页
全屏Dialog示例

全屏Dialog示例

作者: popli | 来源:发表于2017-10-27 14:46 被阅读28次

    final Dialog dialog = new Dialog(context,R.style.weighting_activity);
    Window window = dialog.getWindow();

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {// 在android4.4以上的手机,修改成沉寖式的样式
            try {
                window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
                window.requestFeature(Window.FEATURE_NO_TITLE);
                /* set it to be full screen */
                window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    
        dialog.show();
        Uri uri = Uri.parse("res:///" + R.drawable.virtual_create);
        DraweeController controller = Fresco.newDraweeControllerBuilder().setUri(uri).setAutoPlayAnimations(true).build();
        AbstractAnimatedDrawable animatable = (AbstractAnimatedDrawable) controller.getAnimatable();
        android.view.WindowManager.LayoutParams attributes = window.getAttributes();
        attributes.width = ViewGroup.LayoutParams.MATCH_PARENT;
        attributes.height = ViewGroup.LayoutParams.MATCH_PARENT;
        attributes.windowAnimations = 0;
        window.setAttributes(attributes);
        dialog.setContentView(R.layout.layout_virtualrole_gif);
        SimpleDraweeView draweeView = (SimpleDraweeView) window.findViewById(R.id.body_trend);
        draweeView.setController(controller);

    相关文章

      网友评论

          本文标题:全屏Dialog示例

          本文链接:https://www.haomeiwen.com/subject/bxorpxtx.html