点击按钮弹出dialog

来源:互联网 发布:在线ping测试网络 编辑:程序博客网 时间:2024/05/21 09:15

1.在xml文件里面去写要弹出的dialog的形状    可以添加选择器

2.    Window  w = getWindow();
        ViewGroup decorView = (ViewGroup) w.getDecorView();
        decorView.setBackgroundResource(R.color.transparent);
        View view = LayoutInflater.from(context).inflate(R.layout.dialog_evalution, decorView, false);
        LayoutParams params = view.getLayoutParams();
        params.width = (int) (MyApp.getScreenWidth()*0.80);
        view.setLayoutParams(params);
        ViewUtils.inject(this, view);
        decorView.removeAllViews();
        decorView.addView(view);


0 0