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. IIS7 ASP.NET 未被授权访问所请求的资源

    IIS7 ASP.NET 未被授权访问所请求的资源 ASP.NET 未被授权访问所请求的资源.请考虑授予 ASP.NET 请求标识访问此资源的权限. ASP.NET 有一个在应用程序没有模拟时使用的基 ...

  2. SPRING IN ACTION 第4版笔记-第十章Hitting the database with spring and jdbc-001-Spring对原始JDBC的封装

    1.spring扩展的jdbc异常 2.Template的运行机制 Spring separates the fixed and variable parts of the data-access p ...

  3. 对所有CPU寄存器的简述(16位CPU14个,32位CPU16个)

    32位CPU所含有的寄存器有:4个数据寄存器(EAX.EBX.ECX和EDX)2个变址和指针寄存器(ESI和EDI)2个指针寄存器(ESP和EBP)6个段寄存器(ES.CS.SS.DS.FS和GS)1 ...

  4. SSIS ->> Null & Null Functions

    SSIS不支持值为NULL的变量.每种类型的变量都有自己的默认值. 做了一个测试,用一个Execute SQL Task输出一个NULL值给A变量,然后把A变量传到到另外一个Execute SQL T ...

  5. 如何使用通用Mapper

    集成方法请看上面的文档,集成后,可以继续阅读本页文档. 1. 继承通用的Mapper<T>,必须指定泛型<T> 例如下面的例子: public interface UserIn ...

  6. libevent 定时器timer

    libevent是一个基于事件触发的网络库,memcached底层也是使用libevent库. 总体来说,libevent有下面一些特点和优势:* 事件驱动,高性能:* 轻量级,专注于网络: * 跨平 ...

  7. 蓝牙接收苹果手机通知 ANCS协议分析

    蓝牙接收苹果手机通知 ANCS协议分析 转载,请注明出处:http://www.cnblogs.com/alexcai/p/4321514.html 综述 现在有许多蓝牙手表.手环都能接收苹果ipho ...

  8. AE开发 入门教程

    此过程说明适合那些使用.NET建立和部署应用的开发者,它描述了使用ArcGIS控件建立和部署应用的方法和步骤. 你可以在下面的目录下找到相应的样例程序: <安装目录>/DeveloperK ...

  9. IntelliJ IDEA12.1.1 使用 相关记录

    最近在切换ide 从eclipse平台上转移到   IDEA 其它的都比较容易,让我烦恼的是使用idea 发布工程,使用tomcat 调试 热部署.期间碰到各种问题,纠结好久了:终于成功完成了,特意记 ...

  10. .NET 实现异步处理的集中方式

    对于异步,相信大家都不十分陌生.准确点来说就是方法执行后立即返回,待到执行完毕会进行通知.就是当一个任务在执行的时候,尤其是需要耗费很长的时间进行处理的任务,如果利用单线程进行操作的话,势必造成界面的 ...