protected Dialog onCreateDialog(int id) {
// TODO Auto-generated method stub
switch(id){
case 10:
return new AlertDialog.Builder(Activity13.this)
.setTitle(getString(R.string.title)).setMessage(
getString(R.string.timeout)).setPositiveButton(
getString(R.string.ok),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog,
int which) {
}
}).create(); }
return super.onCreateDialog(id);
}

调用:

showDialog(10);

自定义的view:

 View  dialogView=(LinearLayout) getLayoutInflater().inflate(R.layout.dialog_addip,null);
final AlertDialog.Builder builder =new AlertDialog.Builder(Demo12Activity.this);
builder.setView(dialogView);
showBtn = (Button)findViewById(R.id.show);
showBtn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//这
builder.show();
}
});
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="210dp"
android:background="@drawable/radius_5dp"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:padding="12dp"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginBottom="20dp"
android:textColor="#f75830"
android:textSize="18dp"
android:text="添加ip"/> </LinearLayout> </LinearLayout>

最新文章

  1. Sql Service 的job作业新建过程
  2. WPF 画心2.0版之元旦快乐
  3. phpcmsv9多表联合查询分页功能实现
  4. web基础知识小记
  5. C# Winform学习---MDI窗体的设计,PictureBox控件(图片上一页下一页),Timer控件,MenuStrip控件
  6. Android内存Activity泄露:Threads
  7. C#泛型(二)
  8. 如何添加WebService调用时的用户认证
  9. php返回相对时间(如:20分钟前,3天前)的方法
  10. Powershell 快捷键
  11. 上下文菜单与TrackPopupMenu
  12. mysql 安装及卸载 主从配置
  13. C# 中枚举的一点研究(跳过一些net坑的研究而已)
  14. 菜鸟容易中的招__setattr__
  15. 超实用的JavaScript代码段 Item5 --图片滑动效果实现
  16. 一张图让你懂Python安装第三方库
  17. Alibaba, I&#39;m interested in you.
  18. centos7.2安装图文详解
  19. Android:E/Surface: getSlotFromBufferLocked: unknown buffer: 0x7f9d1b41c0
  20. opencv中mat类介绍

热门文章

  1. shell脚本程序中循环、判断语句的介绍
  2. MFC中编辑框Edit Control添加“变量”后
  3. VC++ :传统剪贴板的延迟提交技术
  4. VC++ 打开文件或文件夹对话框的实现方法
  5. 【iOS与EV3混合机器人编程系列之三】编写EV3 Port Viewer 应用监測EV3port数据
  6. Java精选笔记_面向对象(构造方法、this关键字、static关键字、内部类)
  7. 在线学习angularjs2
  8. shell基础(八)-循环语句
  9. 【RF库Collections测试】Convert To List
  10. 关于微信的jsdk的若干亲身实践之小结