继承Dialog类就可以了,写写布局文件,写写style,就OK了。下面开始。

先上布局文件:

xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="fill_parent"

android:layout_height="fill_parent"

android:orientation="vertical"

android:background="@drawable/bg_dialog_bottom" >

android:layout_width="fill_parent"

android:layout_height="20dip"

/>

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:gravity="center"

android:text="退出确认"

android:textSize="22sp"

android:textColor="#000000"

/>

android:layout_width="fill_parent"

android:layout_height="30dip"

/>

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:gravity="center"

android:text="确定退出程序?"

android:textSize="18sp"

android:textColor="#2E2E2E"

/>

android:layout_width="fill_parent"

android:layout_height="20dip"

/>

android:layout_width="fill_parent"

android:layout_height="wrap_content"

android:gravity="center"

android:orientation="horizontal" >

android:id="@+id/btOK"

android:layout_width="120dip"

android:layout_height="40dip"

android:layout_marginRight="20dip"

android:text="确定"

android:textColor="#454545"

android:background="@drawable/btn_dialog"

/>

android:id="@+id/btCancel"

android:layout_width="120dip"

android:layout_height="40dip"

android:layout_marginLeft="20dip"

android:text="取消"

android:textColor="#454545"

android:background="@drawable/btn_dialog"

/>

android:layout_width="fill_parent"

android:layout_height="30dip"

/>

然后写style

@null

true

true

@null

扩展的Dialog类:

public class MyDialog extends Dialog {

private Button Ok,Cancel;

private Context context;

public MyDialog(Context context) {

super(context);

// TODO Auto-generated constructor stub

this.context = context;

}

public MyDialog(Context context, int theme) {

super(context, theme);

this.context = context;

}

@Override

protected void onCreate(Bundle savedInstanceState) {

// TODO Auto-generated method stub

super.onCreate(savedInstanceState);

this.setContentView(R.layout.dialog);

Ok = (Button)findViewById(R.id.btOK);

Cancel = (Button)findViewById(R.id.btCancel);

Ok.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {

// TODO Auto-generated method stub

Toast.makeText(context, "OK", Toast.LENGTH_SHORT).show();

}

});

Cancel.setOnClickListener(new View.OnClickListener() {

public void onClick(View v) {

// TODO Auto-generated method stub

Toast.makeText(context, "Cancel", Toast.LENGTH_SHORT).show();

}

});

}

}

对比一下效果:

有点差别,一个是selector一个是style写的有点问题,继续研究下。

android自定义退出对话框,Android自定义Dialog(仿QQ同步助手退出对话框)相关推荐

  1. Android自定义Dialog(仿QQ同步助手退出对话框)

    继承Dialog类就可以了,写写布局文件,写写style,就OK了.下面开始. 先上布局文件: <LinearLayout xmlns:android="http://schemas. ...

  2. android qq 仿 退出,Android自定義Dialog(仿QQ同步助手退出對話框)

    繼承Dialog類就可以了,寫寫布局文件,寫寫style,就OK了.下面開始. 先上布局文件: xmlns:android="http://schemas.android.com/apk/r ...

  3. Android仿QQ ios dialog,仿QQ退出向上菜单

    Android仿QQ ios dialog,仿QQ退出向上菜单 EasyDialog两种模式 仿QQ退出向上菜单,自定义向上菜单              github地址:https://githu ...

  4. android 2.0 qq同步,Android刷机:QQ同步助手恢复手机资料攻略

    Android手机火爆的一塌糊涂.走在大街上.坐在地铁里,甚至是上厕所你都会看到有人在使用Android手机.而Android手机的最大乐趣在于开放性,拥有各种各样的ROM,让玩家可以尽情的刷机. 但 ...

  5. android版qq通讯录备份,手机备份首选Android版QQ同步助手的三大理由

    目前,腾讯已发布Android版QQ同步助手,这意味着QQ同步助手已经能够满足S60 V2.V3.V5.iPhone和Android等五大平台手机用户的数据备份需求. 同步助手 本站先以一部S60平台 ...

  6. android版qq通讯录备份通讯录备份,安卓手机怎么备份通讯录 QQ同步助手备份通讯录方法-站长资讯中心...

    随着智能手机的普及,智能手机带来的一些问题也日益增多,比如容易出现故障导致手机数据丢失,或者有时候换了手机导致原来手机上的数据没有导出,特别是通讯录/联系人资料.这时候,养成备份习惯的重要性就十分突出 ...

  7. qq同步android 2.2,QQ同步助手Android2.0版发布

    近日,腾讯发布QQ同步助手Android2.0版,为Android手机用户提供了名片.短信.通话记录等资料的在线备份新服务.至此,QQ同步助手已经覆盖了S60 V2.V3.V5.iPhone和Andr ...

  8. android 2.0 qq同步,QQ同步助手Android2.0版发布:覆盖五大平台

    腾讯科技讯(述来)9月20日消息,近日,腾讯发布QQ同步助手Android2.0版,为Android手机用户提供了名片.短信.通话记录等资料的在线备份新服务.至此,QQ同步助手已经覆盖了S60 V2. ...

  9. QQ同步助手2.0(Android)Build0164正式发布

    来自核桃博客, 详情可查看 [url]http://www.hetaoblog.com/qq-sync-util-2-0-android-build0164/[/url] 近日,腾讯发布QQ同步助手A ...

最新文章

  1. Win10开始菜单中的天气不更新问题的解决方法
  2. XMLHttpRequest cannot load解决方案
  3. 倪海厦天纪笔记16_倪海厦老师讲解天纪易经——第3集(13)
  4. 浅谈ANR及log分析ANR
  5. 吴恩达深度学习笔记11-Course4-Week2【深度卷积网络:实例探究】
  6. Stream流中的常用方法_limit
  7. 关于_vmvare workstation装32ubuntu的问题
  8. Mybatis传入参数类型为Map
  9. 博文视点大讲堂36期——让Oracle跑得更快 成功举办
  10. 二叉树线索化示意图_二叉树的线索化
  11. 【报告分享】2021新茶饮研究报告.pdf(附下载链接)
  12. javaweb(09) EL表达式JSTL标签库(jsp相关,了解)
  13. Matter-JS constraint 约束
  14. h5 打包后效果失效
  15. 产品需求分析工具和方法
  16. 儿童机器人编程语言_儿童编程机器人
  17. 公募基金资格:社保、养老金、企业年金,三者有什么区别?
  18. 微信小程序登录流程理解
  19. python求几何平均_算术平均、几何平均、调和平均、平方平均和移动平均
  20. CAD全版本软件安装包(含最新2023)

热门文章

  1. python怎么快速打括号_Python如何省略括号方法详解
  2. 谋与断——良谋的四大标准
  3. 2015年阿里面试经历总结
  4. Android之滚动控件Recycler
  5. 群与作用3.1-Sylow子群的例子
  6. html5 网页课程设计(二)
  7. cesium 效果篇—毛玻璃
  8. 微信「跳一跳」带火小游戏,开发者如何快速上手?
  9. Unity 布料模拟插件Magica Cloth
  10. ABBYY FineReader16最新PDF图片文字识别软件