android dialog自定义布局文件,Android 中的AlertDialog使用自定义布局

Android使用指定的View开发弹窗功能

Android开发中进程会使用到我们的AlertDialog,但是比较可惜的是我们的Android原生的AlertDialog的效果又比较的简陋,这个时候我们就需要自定义的View去显示了。

Overview

Android 中的AlertDialog 的效果十分的的炫酷。

他的效果是类似弹窗的效果。

那么我们就可以拿他来做很多事情,比如点击添加时,弹出我们的AlertDialog 的效果就十分的棒。那就让我们看一下如何使用它。

首先 我们看一下 我们的 自定义的view 的布局。

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

android:layout_width="400dp"

android:layout_height="470dp"

android:orientation="vertical">

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_marginLeft="10dp"

android:layout_marginTop="20dp"

android:layout_marginRight="10dp"

android:layout_marginBottom="20dp"

android:orientation="vertical">

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:orientation="horizontal">

android:id="@+id/editTodoItems"

android:layout_width="0dp"

android:layout_height="wrap_content"

android:layout_weight="8"

android:hint="今天打算做什么?"

android:textColor="#000000"

android:textSize="14sp" />

android:id="@+id/TodotxtAddItems"

android:layout_width="0dp"

android:layout_height="wrap_content"

android:layout_weight="2"

android:gravity="center"

android:text="添加"

android:textColor="@color/MainColor"

android:textSize="18sp"

android:textStyle="bold" />

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:orientation="horizontal">

android:layout_width="wrap_content"

android:layout_height="35dp"

android:backgroundTint="@color/dark"

app:cardCornerRadius="20dp">

android:id="@+id/today"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical">

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_marginLeft="15dp"

android:layout_marginTop="10dp"

android:layout_marginRight="15dp"

android:layout_marginBottom="10dp"

android:text="今天"

android:textColor="#fff"

android:textSize="12sp" />

android:layout_width="wrap_content"

android:layout_height="35dp"

android:layout_marginLeft="10dp"

android:backgroundTint="@color/dark"

app:cardCornerRadius="20dp">

android:id="@+id/tomorrow"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical">

android:layout_width="match_parent"

android:layout_height="wrap_content"

android:layout_marginLeft="15dp"

android:layout_marginTop="10dp"

android:layout_marginRight="15dp"

android:layout_marginBottom="10dp"

android:text="明天"

android:textColor="#fff"

android:textSize="12sp" />

android:layout_width="wrap_content"

android:layout_height="35dp"

android:layout_marginLeft="10dp"

android:backgroundTint="@color/dark"

app:cardCornerRadius="20dp">

android:id="@+id/selectDay"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical">

android:id="@+id/Day3"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_marginLeft="15dp"

android:layout_marginTop="10dp"

android:layout_marginRight="15dp"

android:layout_marginBottom="10dp"

android:gravity="center"

android:text="选择日期"

android:textColor="#fff"

android:textSize="12sp" />

android:layout_width="wrap_content"

android:layout_height="35dp"

android:layout_marginLeft="10dp"

android:backgroundTint="@color/dark"

app:cardCornerRadius="20dp">

android:id="@+id/intoBox"

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical">

android:layout_width="match_parent"

android:layout_height="match_parent"

android:layout_marginLeft="15dp"

android:layout_marginTop="10dp"

android:layout_marginRight="15dp"

android:layout_marginBottom="10dp"

android:text="

Android中ListView同过自定义布局并使用SimpleAdapter的方式实现数据的绑定

1.listview的数据填充可以通过ArrayAdapter,SimpleAdapter,也可以是一个xml文件,但是ArrayAdapter与SimpleAdapter的区别是: 2 ArrayA ...

Android中使用ListView绘制自定义表格(2)

上回再写了后,很多人留言代码不全和没有数据样例.但因为项目原因,没法把源码全部贴上来.近两天,抽空简化了一下,做了一个例子. 效果图如 ...

Android中使用AlertDialog实现几种不同的对话框

场景 app中常见的对话框. 简单的带确定取消按钮的对话框 带列表的对话框 带单项选择的对话框 带多项选择的对话框 注: 博客: https://blog.csdn.net/badao_liumang ...

Android中常用的5大布局详述

Android的界面是有布局和组件协同完成的,布局好比是建筑里的框架,而组件则相当于建筑里的砖瓦.组件按照布局的要求依次排列,就组成了用户所看见的界面. 所有的布局方式都可以归类为ViewGroup的 ...

Android中SimpleAdapter的使用—自定义列表

本人初学Android,今天研究到Adapter这块感觉挺有意思的,写了个自定义列表进行测试 首先我们新建一个layout列表布局文件,具体布局可以自己设定. 下面贴上我的自定义布局文件代码 < ...

Android中intent如何传递自定义数据类型

转载自:http://www.cnblogs.com/GoAhead/archive/2012/07/16/2593868.html 大家好,好久不见,今天要给大家讲一下Android中Intent中 ...

Android中为TextView增加自定义的HTML标签

Android中的TextView,本身就支持部分的Html格式标签.这其中包括常用的字体大小颜色设置,文本链接等.使用起来也比较方便,只需要使用Html类转换一下即可.比如: textView.se ...

Android中的通知—Notification 自定义通知

Android中Notification通知的实现步骤: 1.获取NotificationManager对象NotificationManager的三个公共方法:①cancel(int id) 取消以 ...

Android中的AlertDialog使用示例五(自定义对话框)

在Android开发中,我们经常会需要在Android界面上弹出一些对话框,比如询问用户或者让用户选择.这些功能我们叫它Android Dialog对话框,AlertDialog实现方法为建造者模式. ...

随机推荐

&lbrack;Codeforces&rsqb; Round &num;320 &lpar;Div&period;2&rpar;

1.前言 虽然这次我依旧没有参加正式比赛,但是事后还是看了看题目的...一般不怎么刷Codeforces. A.Raising Bacteria You are a lover of bacteria ...

用JS来控制 div的高度随浏览器变化而变化

题意:见题面 思路:设dp[i,sta,k]为前i个人已经吃完,从第i人到第i+b[i]人的吃饭状况是sta,前一个吃完的人离i的距离是k(可能为负)的最小值 \[ dp[i+1,sta>&gt ...

代码片段--Makefile之大型工程项目子目录Makefile的一种通用写法

转载:http://blog.csdn.net/mo_hui123456/article/details/8929615 管理Linux环境下的C/C++大型项目,如果有一个智能的Build Syst ...

yum仓库搭建

1. 创建yum仓库目录 mkdir -p /application/yum/centos6.6/x86_64/ cd /application/yum/centos6.6/x86_64/ rz  # ...

ZooKeeper基础

======================================ZooKeeper 背景======================================ZooKeeper 是一 ...

mysql-router的安装与使用

1.下载 https://dev.mysql.com/get/Downloads/MySQL-Router/mysql-router-2.0.4-linux-glibc2.12-x86-64bit.t ...

理解socket&period;io&lpar;一&rpar;---相关的API

理解socket.io(一)---相关的API 1. 什么是Socket.IO?Socket.IO是node.js的一个模块,它用于浏览器与服务端之间实时通信.它提供了服务器和客户端的组件,只需一个模 ...

适配手机端之 rem

(function() { var psdWidth = 1080, maxRem = 100, ch = document.documentElement.clientHeight || docum ...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值