-
仿IOS 对话框
package com.zf.iosdialog.widget;import android.app.Dialog;import android.content.Context;import android.view.Display;import android.view.LayoutInflater;import android.view.View;import android.view.View.OnClickListener;import android.view.WindowManager;import android.widget.Button;import android.widget.FrameLayout;import android.widget.ImageView;import android.widget.LinearLayout;import android.widget.LinearLayout.LayoutParams;import android.widget.TextView;import com.zf.iosdialog.R;public class AlertDialog {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 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 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) {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) {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();}}
- 2015-01-03下载
- 积分:1
-
对 Extjs4 DBExplorer
应用程序来管理 web 上的数据由 extjs 和 springframework1.java 1.5 +2.Extj 3 +4.jdbc
- 2023-03-28 01:45:06下载
- 积分:1
-
电子学习矿工
电子学习矿工,以前DŽEMUj是数据挖掘的工具,从电子学习资料。旨在为教师。
- 2022-02-12 16:59:43下载
- 积分:1
-
AvdManager
Android Virtual Device Manager to manage AVDs for Andriod.
- 2013-10-24 10:31:47下载
- 积分:1
-
java面向对象测试-学生管理系统
资源描述面向对象编程试题
编程实现如下功能:
通过继承学生类(自定义学生类,抽取满足题目要求的学生属性进行定义),编写英语系、计算机系、文学系三个系别的学生类。各系有以下成绩:
? 英语系:演讲、期末考试、期中考试;
? 计算机系:操作能力、英语写作、期中考试、期末考试;
? 文学系:演讲、作品、期末考试、期中考试。
各系总分评测标准如下:
? 英语系:演讲 50%
期末考试 25%
期中考试 25%
? 计算机系:操作能力 40%
英语写作 20%
期末考试 20%
期中考试 20%
? 文学系:演讲 35%
作品 35%
&n
- 2022-08-19 19:21:52下载
- 积分:1
-
从sina上读取股票的交易明细并存入数据库备用
从sina上读取股票的交易明细,并存入数据库备用。使用Java软件开发。
- 2022-05-23 04:37:17下载
- 积分:1
-
android 远程控制实例(基于Socket通信)
通过android实现远程控制,主要用于智能家具控制。
- 2020-12-06下载
- 积分:1
-
fouben-V3.4
This is a useful frequency estimation algorithm matlab simulation program, Achieve a grayscale image and further control for video surveillance, Automatic identification in the matlab environment the size of the connected area.
- 2017-09-15 21:35:41下载
- 积分:1
-
ssh 网上书店
资源描述
利用ssh框架知识设计完成网上书店 有源码和相关解释
喜欢的可以下载查看
- 2022-06-18 07:31:06下载
- 积分:1
-
wordpresszt_gzlzt_v3.9
易秀购主题网发现很多网友比较喜欢格子类型的主题,其实格子类型的主题适合做摄影、图片分享、或者各种设计展示类型的网站,今天我们分享的也是一款wordpress格子主题,这款主题风格是由国内wordpress爱好者原创设计的,借鉴了苹果官方的设计元素,简洁大方而不失现代感,该主题摒弃使用现代大多数WP主题追求和倡导的HTML5等流行元素,后台采用独立的主题设置和SEO设置让使用者更加方便操作,我们不复杂,我们追求简单!更多详情请看主题演示。(Easy to show that many users find purchase THEMANET prefer lattice type of theme, in fact, the theme of the lattice type suitable for photography, photo-sharing, or various types of website design showcase, and today we share is a grid wordpress theme, this theme style lovers by domestic wordpress original design, drawing official Apple design elements, simple and elegant and yet modern, abandon the use of the most modern theme WP theme and advocacy to pursue other popular elements of HTML5, background using a separate theme SEO settings allow users to set up and easier to operate, we are not complicated, we seek simple! For more details see the topic presentation.)
- 2015-04-11 20:36:37下载
- 积分:1