首页 编程 软件学院 查看内容

Android 仿 腾讯应用宝 漂亮 弹出对话框

2015-1-8 11:42 977 0

摘要: [java] view plaincopypublic class DialogMenu {     &nbs...
关键词: nbsp onClickListener Context view private LayoutInflater loadingDialog findViewById Button setOnClickListen

[java] view plaincopypublic class DialogMenu {      private Context mContext;      private TextView tv_title, tv_context;      private Button yes, no;      private View view;      private LayoutInflater layoutInflater;      private Dialog loadingDialog;        public DialogMenu(Context context) {          this.mContext = context;          this.layoutInflater = LayoutInflater.from(context);          onCreateView();      }        public void onCreateView() {          view = layoutInflater.inflate(R.layout.dialog_popup, null);          tv_title = (TextView) view.findViewById(R.id.textView1);          tv_context = (TextView) view.findViewById(R.id.textView2);          yes = (Button) view.findViewById(R.id.button2);          no = (Button) view.findViewById(R.id.button1);          loadingDialog = new Dialog(mContext, R.style.loading_dialog);// 创建自定义样式        }        public void showDialog() {          loadingDialog.show();      }        public void initUI(String title, String msg, String tv_yes, String tv_no) {            tv_title.setText(title);          tv_context.setText(msg);          no.setText(tv_no);          yes.setText(tv_yes);          if (onClickListener != null                  && onClickListener instanceof OnClickListener) {              yes.setOnClickListener(onClickListener);              no.setOnClickListener(onClickListener);          }          loadingDialog.setContentView(view);      }        private OnClickListener onClickListener;        public void setOnClickListener(OnClickListener onClickListener) {          this.onClickListener = onClickListener;      }  }  [java] view plaincopy 声明:文章版权归原作者所有 部分文章转自互联网 如有侵权请联系 [邮箱地址] 删除

路过

雷人

握手

鲜花

鸡蛋

最新评论

返回顶部