关于自定义Dialog的一次折腾
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:background">#00000000</item>
<item name="android:windowBackground">@android:color/transparent</item>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="5dp"/>
<stroke android:width="1dp"
android:color="@android:color/holo_blue_bright"/>
<solid android:color="@android:color/white"/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/dialog_bg_xml">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/dialog_title"
android:textSize="20sp"
android:layout_marginLeft="10dp"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:text="撤销出库单"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/dialog_message"
android:textSize="14sp"
android:layout_marginLeft="15dp"
android:layout_marginBottom="45dp"
android:text="确定撤销出库单YT201405"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginLeft="10dp"
android:layout_marginBottom="10dp"
android:layout_marginRight="10dp">
<Button
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:text="取消"
android:layout_marginRight="35dp"
android:id="@+id/cancle_btn"
android:background="@drawable/dialog_button_bg_xml"
android:textSize="16sp"/>
<Button
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:text="确定"
android:id="@+id/ok_btn"
android:background="@drawable/dialog_button_bg_xml"
android:textSize="16sp"/>
</LinearLayout>
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;
import hospitaltakeout.chuanyue.com.hospitaltakeout.R;
/**
* Created by Administrator on 2016-07-12.
*/
public class MyDialog extends Dialog {
private View view = null;
private TextView title;
private TextView message;
private Button cancle;
private Button ok;
public MyDialog(Context context, View view) {
super(context,R.style.MyDialog);
this.view = view;
}
public MyDialog(Context context) {
super(context,R.style.MyDialog);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (view == null){
setContentView(R.layout.double_botton_layout);
initView();
setListener();
}else{
setContentView(view);
}
}
private void initView(){
title = (TextView) findViewById(R.id.dialog_title);
message = (TextView) findViewById(R.id.dialog_message);
cancle = (Button) findViewById(R.id.cancle_btn);
ok = (Button) findViewById(R.id.ok_btn);
}
private void setListener(){
cancle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
MyDialog.this.dismiss();
}
});
ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
}
});
}
public void setTitle(String str){
title.setText(str);
}
public void setMessage(String str){
message.setText(str);
}
关于自定义Dialog的一次折腾的更多相关文章
- Android—自定义Dialog
在 Android 日常的开发中,Dialog 使用是比较广泛的.无论是提示一个提示语,还是确认信息,还是有一定交互的(弹出验证码,输入账号密码登录等等)对话框. 而我们去看一下原生的对话框,虽然随着 ...
- Android自定义Dialog(美化界面)
前言:在做项目的时候,发现dialog界面太丑陋,从csdn上下载了一份自定义dialog的源码,在他的基础上对界面进行美化...有需要的朋友可以直接拿走 效果图如下: 主要代码: /** * 自定义 ...
- 通用的Dialog自定义dialog
图样:
- Android自定义Dialog及其布局
实际项目开发中默认的Dialog样式无法满足需求,需要自定义Dialog及其布局,并响应布局中控件的事件. 上效果图: 自定义Dialog,LogoutDialog: 要将自定义布局传入构造函数中, ...
- 自定义Dialog宽度占满屏幕
一.自定义Dialog继承Dialog public class MyDialog extends Dialog { 二.为Dialog设置样式 在style中建立新样式继承 @android:sty ...
- 关于实现自定义Dialog和实现Dialog里view的事件监听的两种方法
一.自定义dialog. 二.实现dialog里view的事件监听 1.自定义dialog比较简单.在实例化new的时候,加入样式,布局就行了.或者重写dialog. 2.实现dialog里view的 ...
- 自定义Dialog之信息提示
对话框对于应用也是必不可少的一个组件,在Android中也不例外,对话框对于一些提示重要信息,或者一些需要用户额外交互的一些内容很有帮助. 自定义Dialog步骤: 1.主要创建Java类,并继承Di ...
- android 自定义Dialog背景透明及显示位置设置
先贴一下显示效果图,仅作参考: 代码如下: 1.自定义Dialog public class SelectDialog extends AlertDialog{ public SelectDialog ...
- Android中制作自定义dialog对话框的实例
http://www.jb51.net/article/83319.htm 这篇文章主要介绍了Android中制作自定义dialog对话框的实例分享,安卓自带的Dialog显然不够用,因而我们要继 ...
随机推荐
- 初始化git远程仓库步骤
Git global setup git config --global user.name "bingo" git config --global user.email &quo ...
- java mysql 日期类型
mysql(版本:5.1.50)的时间日期类型如下: datetime 8bytes xxxx-xx-xx xx:xx:xx 1000-01-01 00:00:00到9999-12-31 23:59: ...
- 在MyEclipse显示struts2源码和doc文档及自动完成功能
分类: struts2 2010-01-07 16:34 1498人阅读 评论(1) 收藏 举报 myeclipsestruts文档xmlfileurl 在MyEclipse显示struts2源码和d ...
- kmod编译找不到函数kmod_log
编译报错: /usr/bin/ld: Warning: gc-sections option ignored libkmod/.libs/libkmod-util.a(libkmod-util.o): ...
- Python学习笔记-抽象
懒惰即美德.代码量少. hasattr判断函数是否可用. 创建函数. def hello(name) return 'hello,'+name+'!' 文档化函数: 加注释(#开头) 文档字符串.函数 ...
- Entity Framework Linq 动态组合where条件
public static class PredicateExtensions { public static Expression<Func<T, bool>> True&l ...
- Linux/Unix 线程同步技术之互斥量(1)
众所周知,互斥量(mutex)是同步线程对共享资源访问的技术,用来防止下面这种情况:线程A试图访问某个共享资源时,线程B正在对其进行修改,从而造成资源状态不一致.与之相关的一个术语临界区(critic ...
- JavaWeb--Servlet部分笔记
1.集群:数万个服务器协同工作 2.web应用核心组件:jsp和servlet(属于门户),都在web容器中执行 3.web客户端发http请求(大的字符串)给web服务器:web服务器根据头信息来定 ...
- Spark MLlib 之 Naive Bayes
1.前言: Naive Bayes(朴素贝叶斯)是一个简单的多类分类算法,该算法的前提是假设各特征之间是相互独立的.Naive Bayes 训练主要是为每一个特征,在给定的标签的条件下,计算每个特征在 ...
- C语言程序设计第七次作业
一.学习内容 本次课学习了函数的基本知识,需要大家对如下知识点进行总结: 1. 函数定义的基本格式,函数定义和函数原型(声明)的区别何在? 2. 函数的调用方式有哪几种 ...