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对话框的更多相关文章

  1. android 仿ios 对话框已封装成工具类

    对话框 在android中是一种非经常见的交互提示用户的方式,可是非常多产品狗都叫我们这些做android的仿ios,搞的我们android程序猿非常苦逼,凭什么效果老是仿ios,有没有一点情怀,只是 ...

  2. react-native自定义Modal模态框|仿ios、微信弹窗RN版

    前序 纵观每个优质项目,无论web端还是native原生应用开发,弹窗都是不可忽视的一环,能很大程度上直接决定用户体验.如:微信.支付宝.ios都有很成熟的一套弹窗UI展示场景. 最近一直沉迷在rea ...

  3. Android中仿IOS提示框的实现

    前言 在Android开发中,我们有时需要实现类似IOS的对话框.今天我就来总结下,如何通过自定义的开发来实现类似的功能. 自定义Dialog 我们知道Android中最常用的对话框就是Dialog及 ...

  4. Dialog详解(包括进度条、PopupWindow、自定义view、自定义样式的对话框)

    Dialog详解(包括进度条.PopupWindow.自定义view.自定义样式的对话框)   Android中提供了多种对话框,在实际应用中我们可能会需要修改这些已有的对话框.本实例就是从实际出发, ...

  5. WPF C#仿ios 安卓 红点消息提示

    原文:WPF C#仿ios 安卓 红点消息提示 先把效果贴出来,大家看看. 代码下载地址: http://download.csdn.net/detail/candyvoice/9730751 点击+ ...

  6. (转载) Android 带清除功能的输入框控件ClearEditText,仿IOS的输入框

    Android 带清除功能的输入框控件ClearEditText,仿IOS的输入框 标签: Android清除功能EditText仿IOS的输入框 2013-09-04 17:33 70865人阅读  ...

  7. Html - 仿Ios assistiveTouch 悬浮辅助球工具

    仿Ios assistiveTouch 悬浮辅助球工具 <!DOCTYPE html> <html> <head> <meta charset="u ...

  8. Android仿IOS回弹效果 ScrollView回弹 总结

    Android仿IOS回弹效果  ScrollView回弹 总结 应项目中的需求  须要仿IOS 下拉回弹的效果 , 我在网上搜了非常多 大多数都是拿scrollview 改吧改吧 试了一些  发现总 ...

  9. 自定义仿 QQ 健康计步器进度条

    自定义仿 QQ 健康计步器进度条 版权声明:本文为博主原创文章,未经博主允许不得转载. 微博:厉圣杰 源码:CircleProgress 文中如有纰漏,欢迎大家留言指出. 闲着没事,趁上班时间偷偷撸了 ...

随机推荐

  1. Knight's Trip---hdu3766(马走日求最小走的步数)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3766 给你一个x ,y 求出从(0,0)位置到达需要的最小步数每次只能走日型: 下图为暴力bfs得到的 ...

  2. list、set、map的特点

    java 集合(list.set.map)的特点 集合相关的类有一大堆,一般也只用到常用的方法增删改查,而且它它们的方法名也基本一样,所以一直都不知道什么时候用什么集合, 今天趁有空特意从网上整理资料 ...

  3. SQL Server ->> 关于究竟ALTER INDEX ... REBUILD会不会导致改变索引选项和Filegroup的验证

    其实之前做过类型的验证,不过影响不是特别深,只是记得不会改变DATA COMPRESSION,那今天再次遇到这个问题就再拿出来验证一下.随便写个脚本验证下.ALTER INDEX ... REBUIL ...

  4. 使用VNC远程连接Windows Azure Linux虚拟机

    本文以Oracle Linux 6.4虚拟机为示例 一. 安装 tigervnc-server 使用“rpm -qa vnc”指令查看是否安装vnc服务,如果没有安装,则可以使用yum或者rpm进行安 ...

  5. ExtJS4之Ext.MessageBox的各种用法

    1. Ext.Msg.alert(String title,String msg)[Ext.MsssageBox.alert(Sting title,Sting msg,fn)]与javascript ...

  6. hdu - 1829 A Bug's Life (并查集)&&poj - 2492 A Bug's Life && poj 1703 Find them, Catch them

    http://acm.hdu.edu.cn/showproblem.php?pid=1829 http://poj.org/problem?id=2492 臭虫有两种性别,并且只有异性相吸,给定n条臭 ...

  7. 重新安装sqlyog时备份数据库链接列表的方法

    一般在本机C:\Documents and Settings\Administrator\Application Data\SQLyog这个目录下有个sqlyog.ini文件.把这个文件备份一下就ok ...

  8. Linux同步机制(二) - 条件变量,信号量,文件锁,栅栏

    1 条件变量 条件变量是一种同步机制,允许线程挂起,直到共享数据上的某些条件得到满足. 1.1 相关函数 #include <pthread.h>  pthread_cond_t cond ...

  9. plsql programming 04 条件和顺序控制

    1. 条件语句 if salary > 40000 or salary is NULL then give_bonus(employee_id, 500); end if; if conditi ...

  10. 【转载】关于XML文档的xmlns、xmlns:xsi和xsi:schemaLocation

    原文在: https://yq.aliyun.com/articles/40353 这里有转载:http://www.cnblogs.com/zhao1949/p/5652167.html 先来一段S ...