自定义AlertDialog的样式
一、在XML中定义好要显示的AlertDialog的布局
二、在代码中创建alertdialog 对象
AlertDialog dialog = new AlertDialog.Builder(this).create();
调用show方法显示
dialog.show();
三、设置 AlertDialog窗体的大小
dialog.getWindow().setGravity(Gravity.CENTER);
dialog.getWindow().setLayout((int)(width/1.5), LayoutParams.WRAP_CONTENT);
点击输入框时用来显示软键盘
dialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
显示布局
dialog.getWindow().setContentView(roleAlertLayout);
当单击外层布局时隐藏软键盘
layout.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
InputMethodManager imm = (InputMethodManager)getSystemService(PageRole.this.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(roleEdit.getWindowToken(), 0);
}
});
自定义AlertDialog的样式的更多相关文章
- 安卓—自定义 AlertDialog 的样式
自定义修改安卓弹出框的样式 效果图: 1.在style.xml下添加 <!-- 自定义弹出样式 --> <style name="MyDialogStyle" p ...
- AlertDialog.Builder 样式设置
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(this, R.style.AlertDia ...
- jQuery Validate 表单验证插件----自定义校验结果样式
一.下载依赖包 网盘下载:https://yunpan.cn/cryvgGGAQ3DSW 访问密码 f224 二.引入依赖包 <script src="../../scripts/j ...
- Android 自定义RadioButton的样式
Android 自定义RadioButton的样式 我们知道Android控件里的button,listview可以用xml的样式自定义成自己希望的漂亮样式. 最近用到RadioButton,利用xm ...
- ActionBar官方教程(11)自定义ActionBar的样式(含重要的样式属性表及练习示例)
Styling the Action Bar If you want to implement a visual design that represents your app's brand, th ...
- 自定义input file样式
自定义input file样式:一般都是通过隐藏input,通过定义label来实现.这种做法要注意的是label的for属性要指定input对应的id; <!DOCTYPE html> ...
- WPF界面设计技巧(4)—自定义列表项样式
原文:WPF界面设计技巧(4)-自定义列表项样式 有前面修改按钮样式的基础,我们可以尝试来定制一个即好看又好用的 ListBox ,今天先来讲“好看”部分. 打开 Microsoft Visual S ...
- css Cursor:url()自定义鼠标指针样式为图片
css自定义鼠标指针样式为图片Cursor:url()的使用,今天在项目中,要用到自定义鼠标样式,格式: css:{cursor:url('绝对路径的图片(格式:cur,ico)'),-moz-zoo ...
- Android之自定义AlertDialog和PopupWindow实现(仿微信Dialog)
我们知道,在很多时候,我们都不用Android内置的一些控件,而是自己自定义一些自己想要的控件,这样显得界面更美观. 今天主要是讲自定义AlertDialog和popupWindow的使用,在很多需求 ...
随机推荐
- POJ 2528 Mayor's posters
Mayor's posters Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Sub ...
- Debian/Ubuntu/CentOS VPS安装Net-Speeder并优化
安装过程: CentOS安装 wget --no-check-certificate https://gist.github.com/LazyZhu/dc3f2f84c336a08fd6a5/raw/ ...
- Dom4j解析xml
public class Dom4jTest { // Dom4j解析xml // 因为所有的方法都需要Dom树 static Document document = null; static Ele ...
- hello 漂亮的小靓仔
<form type="text" name="超级" method="post"> <table align=" ...
- MRPT笔记——MRPT在VS2013中的配置
Mobile Robot Programming Toolkit (MRPT)是一个跨平台的.开源的C++库,旨在帮助机器人研究员设计和实现SLAM.机器视觉和运动规划(避障)的算法. MRPT为移动 ...
- ArcEngine拓扑
空间拓扑描述的是自然界地理对象的空间位置关系-相邻,重合,连通等,是地理对象空间属性的一部分.目前ESRI提供的数据存储方式中,Coverage和GeoDatabase能够建立拓扑,Shape格式的数 ...
- android开发-mvp模式理解
看之前,先忘掉所有,一步步看就行了. 最后会有一个原型demo,当然是转的了.看完文章,再看demo,然后再回头看文章就很好理解了,最好自己写一遍. 1.mvp开发模式可以理解为页面接口编程,每一层的 ...
- android 测试 Monkey 和 MonkeyRunner 的使用
一.Monkey的使用 Monkey使用起来比较简单,简而言之就是模拟手机点击效果,随机发送N个点击动作给手机,主要对于程序的稳定和承受压力的测试. 1.首先连接上你的手机或者启动模拟器: 2.运行C ...
- LCD底层驱动分析
根据分析的框架,自己写一个LCD驱动程序 1分析LCD硬件原理图 Von和Voff接的是一个电源电路,通过LCD_POWER接的是GPG4来控制LCD电源,高电平表示开启LCD电源 VM接的是CPU的 ...
- VMware-workstation-full-12.0.0-2985596&VMware-player-12.0.0-2985596
VMware-workstation-full-12.0.0-2985596 永久KEY:YV3D2-A0D50-481XP-KPNGE-ZV2ZF VMware-player-12.0.0-2985 ...