android DialogBuilder

来源:互联网 发布:网络监控是什么 编辑:程序博客网 时间:2024/06/05 22:34

 Dialog  dialog=new DialogBuilder(this).setView(R.layout.alert_view).create(); dialog.show();
去除title 

找view中的

dialog.<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">findviewbyid()</span>

import android.app.Dialog;import android.content.Context;import android.view.View;import android.view.Window;/** * Created by sunger on 15/5/29. */public class DialogBuilder {private  Context context;    private  View dialogView;    private  int dialogViewId=-1;    public  DialogBuilder(Context context){        this.context=context;    }    public Dialog create(){        Dialog dialog=new Dialog(context);        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);        if (dialogView!=null)            dialog.setContentView(dialogView);        else if(dialogViewId!=-1)            dialog.setContentView(dialogViewId);        return  dialog;    }    public DialogBuilder setView(View v){        this.dialogView=v;        return this;    }    public DialogBuilder setView(int viewId ){        this.dialogViewId=viewId;        return this;    }}



0 0