自己定义Android Dialog
private void showDialog()
{
mDialog = new Dialog(this);
mDialog.setCanceledOnTouchOutside(true); Window dialogWindow = mDialog.getWindow();
dialogWindow.setBackgroundDrawable(new ColorDrawable(0));
dialogWindow.setContentView(R.layout.set_public_client_dialog); mDialog.show(); Button cancelbtn = (Button) dialogWindow.findViewById(R.id.cancelbtn);
cancelbtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mDialog.dismiss();
}
}); Button confirmbtn = (Button) dialogWindow.findViewById(R.id.confirmbtn);
confirmbtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
mDialog.dismiss();
}
}); }
<?xml version="1.0" encoding="utf-8"? >
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="306dp"
android:layout_height="262dp"
android:layout_gravity="center"
android:background="@drawable/followupdialog_306_202" > <FrameLayout
android:layout_width="140dp"
android:layout_height="32dp"
android:layout_marginLeft="-4dp"
android:layout_marginTop="7dp"
android:background="@drawable/redrobin_89_32" > <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:layout_marginLeft="13dp"
android:layout_marginTop="4dp"
android:text="@string/set_public_reason"
android:textColor="@color/white"
android:textSize="15sp" />
</FrameLayout> <EditText
android:id="@+id/et_additional_reason"
android:layout_width="257dp"
android:layout_height="33dp"
android:layout_above="@+id/bottom_btns"
android:layout_centerHorizontal="true"
android:layout_marginBottom="3dp"
android:background="@drawable/redline_257_33"
android:hint="@string/et_additional_reason_hint"
android:paddingLeft="5dp"
android:singleLine="true"
android:textSize="14sp" /> <LinearLayout
android:id="@+id/bottom_btns"
android:layout_width="299dp"
android:layout_height="44dp"
android:layout_alignParentBottom="true"
android:layout_marginBottom="6dp"
android:layout_marginLeft="7dp"
android:layout_marginRight="1dp"
android:orientation="horizontal" > <Button
android:id="@+id/cancelbtn"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@drawable/followupdialogbtn"
android:text="@string/cancel"
android:textColor="@color/black" /> <ImageView
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="0.01"
android:background="@color/linecolor" /> <Button
android:id="@+id/confirmbtn"
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight="1"
android:background="@drawable/followupdialogbtn"
android:text="@string/confirm"
android:textColor="@color/black" />
</LinearLayout> <ImageView
android:layout_width="299dp"
android:layout_height="0.5dp"
android:layout_above="@id/bottom_btns"
android:layout_marginLeft="7dp"
android:background="@color/linecolor" /> </RelativeLayout>
自己定义Android Dialog的更多相关文章
- 自己定义一个Dialog样式的Activity窗体,切换到Dialog的方法
首先定义一个style 在style里面加入 <style name="MyDialog" parent="@android:Theme.Dialog"& ...
- Android Dialog对话框的七种形式的使用
参考资料:http://www.oschina.net/question/54100_32486 注:代码进行了整理 在Android开发中,我们经常会需要在Android界面上弹出一些对话框,比如询 ...
- Android Dialog使用举例
在Android开发中,我们经常会需要在Android界面上弹出一些对话框,比如询问用户或者让用户选择.这些功能我们叫它Android Dialog对话框,在我们使用Android的过程中,我归纳了一 ...
- android dialog 原来dialog对话框也有自己的按键监听事件 onKeyDown方法
探讨在一个activity中按menu键时弹出自己定义的dialog(自定义菜单对话框)时,再按一次手机的menu键发现这个自定义的dialog菜单并没有关闭,原来是这个dialog内部也有onKey ...
- Android Dialog 创建上下文菜单
Android Dialog中的listview创建上下文菜单 listView.setOnCreateContextMenuListener(new OnCreateContextMenuListe ...
- Android控件——7种形式的Android Dialog使用举例(转载)
在Android开发中,我们经常会需要在Android界面上弹出一些对话框,比如询问用户或者让用户选择.这些功能我们叫它Android Dialog对话框,在我们使用Android的过程中,我归纳了一 ...
- 8种形式的Android Dialog使用举例
在Android开发中,我们经常会需要在Android界面上弹出一些对话框,比如询问用户或者让用户选择.这些功能我们叫它Android Dialog对话框,在我们使用Android的过程中,我归纳了一 ...
- android怎样写一个自己定义的dialog能够在Title的位置弹出来
先上效果图: Title的Layout为: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/andr ...
- Android Dialog用法
摘要: 创建对话框 一个对话框一般是一个出现在当前Activity之上的一个小窗口. 处于下面的Activity失去焦点, 对话框接受所有的用户交互. 对话框一般用于提示信息和与当前应用程序直接相关的 ...
随机推荐
- class A<T> where T:new()相关知识点
来源:http://www.cnblogs.com/FredWang/p/4284251.html class A<T> where T:new() ===>>> ...
- Jetty容器配置https
Configuring the Jetty Container as a Https Connector Jetty版本:9.2.22.v20170606 Pom.xml <?xml versi ...
- 【Five-Minute Share】“为什么要选择自增型的主键”
我们在开发的时候经常会听到这样的建议:1. 设计数据库表的时候,要为每个表设置一个主键:2. 主键最好是跟业务无关的: 3. 最好是自增的: 于是,很多新入行的程序猿们把这些前辈们的教条拿来就用,每个 ...
- MyProject
[PROJECT_20190101]20371230[PROJECT_20190101]
- redis的跳跃表
跳跃表是一种插入.查询.删除的平均时间复杂度为O(nlogn)的数据结构,在最差情况下是O(n),当然这几乎很难出现. 和红黑树相比较 最差时间复杂度要差很多,红黑树是O(nlogn),而跳跃表是O( ...
- vs2012下 error4996
原文链接:http://blog.csdn.net/xidianzhimeng/article/details/11457045 分类: VS使用学习 2013-09-09 08:37 24人阅读 评 ...
- ML及AI资源索引
原文链接:http://blog.csdn.net/pongba/article/details/2915005 机器学习与人工智能学习资源导引 TopLanguage(https://groups. ...
- SPL类
用途:对类,方法,属性,参数的提取生成文档:自动加载插件 实列化类同于new:$ref = new ReflectionClass($classname);$class = $ref->newI ...
- mvc cshtml 中赋值
@{ var str = ""; str = item.ApplyStatus == ? ? ? ? "申请驳回" : ""; } < ...
- 操作ajax生成页面的一个问题
一般而言,js代码都放在页面的底部.在做项目的过程中,发现放在底部的代码没有执行,原来操作的是ajax生成的部分.这时候,页面加载js的顺序就要小心了.例子如下: <!doctype html& ...