44、自定义仿IOS对话框
private Dialog myDialog = null; private void ExitLogin() {
View view = LayoutInflater.from(MainActivity.this).inflate(R.layout.activity_exit_dialog, null);
Button btn_close = (Button) view.findViewById(R.id.btn_close);
Button btn_ok = (Button) view.findViewById(R.id.btn_ok);
ImageView img_close = (ImageView) view.findViewById(R.id.img_close);
img_close.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
myDialog.dismiss();
}
}); btn_close.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
myDialog.dismiss();
}
}); btn_ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
myDialog.dismiss();
}
}); myDialog = new Dialog(MainActivity.this, R.style.utils_dialog_loading_dialog_style);
myDialog.setCancelable(false);
myDialog.setContentView(view, new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.MATCH_PARENT,
LinearLayout.LayoutParams.MATCH_PARENT));
myDialog.show();
}
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/bg_dialog"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true" > <RelativeLayout
android:layout_width="280dp"
android:layout_height="wrap_content"
android:orientation="vertical"
android:id="@+id/pop_student"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"> <TextView
android:id="@+id/txt01"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@android:color/black"
android:textSize="18sp"
android:text="确定要退出吗?"
android:layout_marginTop="50dp"
android:layout_marginBottom="40dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
/> <LinearLayout
android:id="@+id/layout_01"
android:layout_below="@id/txt01"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" >
<Button
android:id="@+id/btn_close"
android:layout_width="wrap_content"
android:layout_height="43dp"
android:layout_weight="1"
android:background="@drawable/bg_dialog_button_left"
android:gravity="center"
android:textColor="@android:color/black"
android:text="取消"
android:textSize="16sp" /> <ImageView
android:id="@+id/img_line"
android:layout_width="0.5dp"
android:layout_height="43dp"
android:background="#c6c6c6" /> <Button
android:id="@+id/btn_ok"
android:text="确认"
android:layout_width="wrap_content"
android:layout_height="43dp"
android:layout_weight="1"
android:background="@drawable/bg_dialog_button_right"
android:gravity="center"
android:textColor="@android:color/black"
android:textSize="16sp"
android:textStyle="bold" />
</LinearLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/hint"
android:layout_alignTop="@+id/layout_01"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" /> <ImageView
android:id="@+id/img_close"
android:layout_marginTop="10dp"
android:layout_marginRight="10dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/exit_dialog_close"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" /> </RelativeLayout>
</RelativeLayout>
bg_dialog_button_left.xml
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="#ffffff" />
<corners android:bottomLeftRadius="30dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="0dp"
android:topRightRadius="0dp" />
<padding android:top="10dp"
android:bottom="10dp"
android:left="30dp"
android:right="30dp" />
</shape>
</item> <item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/code09" />
<corners android:bottomLeftRadius="30dp"
android:bottomRightRadius="0dp"
android:topLeftRadius="0dp"
android:topRightRadius="0dp" />
<padding android:top="10dp" android:bottom="10dp"
android:left="30dp" android:right="30dp" />
</shape>
</item>
</selector>
bg_dialog_button_right.xml
<?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item>
<shape android:shape="rectangle">
<solid android:color="#ffffff" />
<corners android:bottomLeftRadius="0dp" android:bottomRightRadius="30dp"
android:topRightRadius="0dp" android:topLeftRadius="0dp"/>
<padding android:right="25dp" android:left="25dp" android:top="10dp"
android:bottom="10dp" />
</shape>
</item> <item android:state_pressed="true">
<shape android:shape="rectangle">
<solid android:color="@color/code09" />
<padding android:bottom="10dp" android:top="10dp"
android:left="25dp" android:right="25dp"/>
<corners android:bottomLeftRadius="0dp" android:bottomRightRadius="30dp"
android:topRightRadius="0dp" android:topLeftRadius="0dp"/>
</shape>
</item> </selector>
44、自定义仿IOS对话框的更多相关文章
- android 仿ios 对话框已封装成工具类
对话框 在android中是一种非经常见的交互提示用户的方式,可是非常多产品狗都叫我们这些做android的仿ios,搞的我们android程序猿非常苦逼,凭什么效果老是仿ios,有没有一点情怀,只是 ...
- react-native自定义Modal模态框|仿ios、微信弹窗RN版
前序 纵观每个优质项目,无论web端还是native原生应用开发,弹窗都是不可忽视的一环,能很大程度上直接决定用户体验.如:微信.支付宝.ios都有很成熟的一套弹窗UI展示场景. 最近一直沉迷在rea ...
- Android中仿IOS提示框的实现
前言 在Android开发中,我们有时需要实现类似IOS的对话框.今天我就来总结下,如何通过自定义的开发来实现类似的功能. 自定义Dialog 我们知道Android中最常用的对话框就是Dialog及 ...
- Dialog详解(包括进度条、PopupWindow、自定义view、自定义样式的对话框)
Dialog详解(包括进度条.PopupWindow.自定义view.自定义样式的对话框) Android中提供了多种对话框,在实际应用中我们可能会需要修改这些已有的对话框.本实例就是从实际出发, ...
- WPF C#仿ios 安卓 红点消息提示
原文:WPF C#仿ios 安卓 红点消息提示 先把效果贴出来,大家看看. 代码下载地址: http://download.csdn.net/detail/candyvoice/9730751 点击+ ...
- (转载) Android 带清除功能的输入框控件ClearEditText,仿IOS的输入框
Android 带清除功能的输入框控件ClearEditText,仿IOS的输入框 标签: Android清除功能EditText仿IOS的输入框 2013-09-04 17:33 70865人阅读 ...
- Html - 仿Ios assistiveTouch 悬浮辅助球工具
仿Ios assistiveTouch 悬浮辅助球工具 <!DOCTYPE html> <html> <head> <meta charset="u ...
- Android仿IOS回弹效果 ScrollView回弹 总结
Android仿IOS回弹效果 ScrollView回弹 总结 应项目中的需求 须要仿IOS 下拉回弹的效果 , 我在网上搜了非常多 大多数都是拿scrollview 改吧改吧 试了一些 发现总 ...
- 自定义仿 QQ 健康计步器进度条
自定义仿 QQ 健康计步器进度条 版权声明:本文为博主原创文章,未经博主允许不得转载. 微博:厉圣杰 源码:CircleProgress 文中如有纰漏,欢迎大家留言指出. 闲着没事,趁上班时间偷偷撸了 ...
随机推荐
- iOS开发--动画篇之layout动画深入
"不得不说,单单是文章的标题,可能不足以说明本文的内容.因此,在继续讲述约束动画之前,我先放上本文要实现的动画效果." 编辑:Bison投稿:Sindri的小巢 约束动画并不是非常 ...
- React可控组件与不可控组件
一.不可控组件 1.简介 2.代码 <!DOCTYPE html> <html lang="zh-cn"> <head> <meta ch ...
- Visual studio C#语言输出调试信息到Output窗口方法
1.菜单栏: 工具>选项>调试>将所有输出窗口文本重定向到即时窗口 2.使用Console.WriteLine或Write添加调试信息 3.按F5启动调试程序 4. ...
- Array.prototype.slice.call(document.querySelectorAll('a'), 0)
Array.prototype.slice.call(document.querySelectorAll('a'), 0)的作用就是将一个DOM NodeList 转换成一个数组. slice()方法 ...
- 使用RPM管理软件包
一.概念简介 RPM 全名是『 RedHat Package Manager 』简称则为 RPM,是以一种数据库记录的方式来将你所需要的套件安装到你的 Linux 主机的一套管理程序. 二.实验环境 ...
- 局部敏感哈希Locality Sensitive Hashing(LSH)之随机投影法
1. 概述 LSH是由文献[1]提出的一种用于高效求解最近邻搜索问题的Hash算法.LSH算法的基本思想是利用一个hash函数把集合中的元素映射成hash值,使得相似度越高的元素hash值相等的概率也 ...
- ado执行sql查询出现“发送数据流时出现算术溢出”错误
开发一个数据采集监控系统,比较变态的是有将近2000项数据.根据数据类型分多个表存储.数据库访问层采用ado.最近发现当一条sql一次性查询1700多个字段数据后就出现“发送数据流时出现算术溢出”错误 ...
- dojo 二 AMD模块
可参考官方教程:http://dojotoolkit.org/documentation/tutorials/1.7/hello_dojo/教程里主要定义了两个方法,setText设置文本内容和res ...
- curl 查看网站连接情况
curl -o /dev/null -s -w "nslookup_time :%{time_namelookup}\n time_connect: %{time_connect}\ntim ...
- What floating point types are available in .NET?
The C# standard only lists double and float as floating points available (those being the C# shortha ...