当前位置: 首页 > news >正文

建设电商网站需要多少钱家具网页设计素材

建设电商网站需要多少钱,家具网页设计素材,怎样做品牌推广,黑龙江网站建设公司当Android开发处理错误信息时#xff0c;经常会以Dialog的形式显示错误信息#xff0c;但是每次都new一个Dialog#xff0c;很麻烦#xff0c;也增加程序的开销#xff0c;所以今天就分享一种自定义单例AlertDialogpublic class AlertDialog {private static AlertDialog …当Android开发处理错误信息时经常会以Dialog的形式显示错误信息但是每次都new一个Dialog很麻烦也增加程序的开销所以今天就分享一种自定义单例AlertDialogpublic class AlertDialog {private static AlertDialog alertDialog null;private Context context;private Dialog dialog;private LinearLayout lLayout_bg;private TextView txt_title;private TextView txt_msg;private Button btn_neg;private Button btn_pos;private ImageView img_line;private Display display;private boolean showTitle false;private boolean showMsg false;private boolean showPosBtn false;private boolean showNegBtn false;public static AlertDialog getInstance(Context context){if (alertDialognull){synchronized (AlertDialog.class) {if (alertDialog null) {alertDialog new AlertDialog(context).builder();}}}return alertDialog;}public AlertDialog(Context context) {this.context context;WindowManager windowManager (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);display windowManager.getDefaultDisplay();}public AlertDialog builder() {// 获取Dialog布局View view LayoutInflater.from(context).inflate(R.layout.view_alertdialog, null);// 获取自定义Dialog布局中的控件lLayout_bg (LinearLayout) view.findViewById(R.id.lLayout_bg);txt_title (TextView) view.findViewById(R.id.txt_title);txt_title.setVisibility(View.GONE);txt_msg (TextView) view.findViewById(R.id.txt_msg);txt_msg.setVisibility(View.GONE);btn_neg (Button) view.findViewById(R.id.btn_neg);btn_neg.setVisibility(View.GONE);btn_pos (Button) view.findViewById(R.id.btn_pos);btn_pos.setVisibility(View.GONE);img_line (ImageView) view.findViewById(R.id.img_line);img_line.setVisibility(View.GONE);// 定义Dialog布局和参数dialog new Dialog(context, R.style.AlertDialogStyle);dialog.setContentView(view);// 调整dialog背景大小lLayout_bg.setLayoutParams(new FrameLayout.LayoutParams((int) (display.getWidth() * 0.85), LayoutParams.WRAP_CONTENT));return this;}public AlertDialog setTitle(String title) {showTitle true;if (.equals(title)) {txt_title.setText(标题);} else {txt_title.setText(title);}return this;}public AlertDialog setMsg(String msg) {showMsg true;if (.equals(msg)) {txt_msg.setText(内容);} else {txt_msg.setText(msg);}return this;}public AlertDialog setMsg(int rId) {showMsg true;txt_msg.setText(rId);return this;}public AlertDialog setCancelable(boolean cancel) {dialog.setCancelable(cancel);return this;}public AlertDialog setPositiveButton(String text,final OnClickListener listener) {showPosBtn true;if (.equals(text)) {btn_pos.setText(确定);} else {btn_pos.setText(text);}btn_pos.setOnClickListener(new OnClickListener() {Overridepublic void onClick(View v) {if(listener!null) {listener.onClick(v);}dialog.dismiss();}});return this;}public AlertDialog setNegativeButton(String text,final OnClickListener listener) {showNegBtn true;if (.equals(text)) {btn_neg.setText(取消);} else {btn_neg.setText(text);}btn_neg.setOnClickListener(new OnClickListener() {Overridepublic void onClick(View v) {if(listener!null) {listener.onClick(v);}dialog.dismiss();}});return this;}private void setLayout() {if (!showTitle !showMsg) {txt_title.setText();txt_title.setVisibility(View.VISIBLE);}if (showTitle) {txt_title.setVisibility(View.VISIBLE);}if (showMsg) {txt_msg.setVisibility(View.VISIBLE);}if (!showPosBtn !showNegBtn) {btn_pos.setText(确定);btn_pos.setVisibility(View.VISIBLE);btn_pos.setBackgroundResource(R.drawable.alertdialog_single_selector);btn_pos.setOnClickListener(new OnClickListener() {Overridepublic void onClick(View v) {dialog.dismiss();}});}if (showPosBtn showNegBtn) {btn_pos.setVisibility(View.VISIBLE);btn_pos.setBackgroundResource(R.drawable.alertdialog_right_selector);btn_neg.setVisibility(View.VISIBLE);btn_neg.setBackgroundResource(R.drawable.alertdialog_left_selector);img_line.setVisibility(View.VISIBLE);}if (showPosBtn !showNegBtn) {btn_pos.setVisibility(View.VISIBLE);btn_pos.setBackgroundResource(R.drawable.alertdialog_single_selector);}if (!showPosBtn showNegBtn) {btn_neg.setVisibility(View.VISIBLE);btn_neg.setBackgroundResource(R.drawable.alertdialog_single_selector);}}public void show() {setLayout();dialog.show();}}布局文件view_alertdialog.xmlandroid:idid/lLayout_bgandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:backgrounddrawable/alert_bgandroid:orientationverticalandroid:idid/txt_titleandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:layout_marginLeft15dpandroid:layout_marginRight15dpandroid:layout_marginTop15dpandroid:gravitycenterandroid:text提示android:textColorcolor/blackandroid:textSize18dp /android:idid/txt_msgandroid:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:layout_marginLeft15dpandroid:layout_marginRight15dpandroid:layout_marginTop10dpandroid:layout_marginBottom10dpandroid:gravitycenterandroid:text您确定要退出吗android:textColorcolor/blackandroid:textSize16dp /android:layout_widthmatch_parentandroid:layout_height0.5dpandroid:layout_marginTop10dpandroid:backgroundcolor/alertdialog_line /android:layout_widthmatch_parentandroid:layout_heightwrap_contentandroid:orientationhorizontalandroid:idid/btn_negandroid:layout_widthwrap_contentandroid:layout_height43dpandroid:layout_weight1android:backgrounddrawable/alertdialog_left_selectorandroid:gravitycenterandroid:text确定android:textColorcolor/bigtextcolorandroid:textSize16sp /android:idid/img_lineandroid:layout_width0.5dpandroid:layout_height43dpandroid:backgroundcolor/alertdialog_line /android:idid/btn_posandroid:layout_widthwrap_contentandroid:layout_height43dpandroid:layout_weight1android:backgrounddrawable/alertdialog_right_selectorandroid:gravitycenterandroid:text取消android:textColorcolor/themecolorandroid:textSize16sp /效果显示以上就是本文的全部内容希望对大家的学习有所帮助也希望大家多多支持编程圈。
http://www.zqtcl.cn/news/672377/

相关文章:

  • 物流网站html5模板网站整站开发
  • 网站随机代码网站开发技术试验教程
  • 做翻译 网站吗仿京东电商的网站开发报价
  • 霞山网站建设公司网站开发怎样手机号验证
  • 大型门户网站建设苏州优化网站建设
  • 网站步骤怎么搭建个人网站
  • 荥阳网站建设公司wordpress会员上限
  • 采购需求网站建设呼伦贝尔网站开发
  • 东莞网站建设方案服务极速网站建设定制价格
  • 网站建设费记账福州百度网络推广
  • 中国农村建设网站邵阳房产网
  • 做非法网站网站上海备案查询
  • 网站制作要学哪些北京信管局 网站备案
  • 百度新闻源网站有哪些wordpress怎么配置七牛cdn加速
  • 山东城乡住房建设厅网站wordpress 购物网站主题
  • 石家庄制作网站查网站流量查询工具
  • 信誉好的永州网站建设静态网站的短处
  • wordpress主题汉化软件河南网站优化哪家好
  • 关于水果的网站建设前端页面设计
  • 随州网站推广哪家好河南网站seo营销多少费用
  • 重庆网站优化排名软件方案谁能做网站开发
  • 河南官网网站建设报价app网站制作多少钱
  • 做网站页面一般用什么软件网站建设项目说明书
  • 做国外lead应该做什么网站网站运营报告
  • 建立一个自己的网站需要多少钱我的世界查找建筑网站
  • 广州网站建设互广做响应式网站设计图是多大的
  • 网站建设 运维 管理包括建大网站首页
  • 快手做任务网站python基础教程作者
  • 网站添加 百度商桥企信网查询
  • 用易语言可以做网站吗西安外贸网站开发