- 浏览: 123021 次
- 性别:
- 来自: 广州
文章分类
最新评论
-
563721501:
结果好像有错
JAVA正则表达式实例教程 -
fanfq:
RoyMax 写道靠,我的文章在这里出来了,源连接在这里 ht ...
PhoneGap VS. Titanium -
yanyanquan:
我尝试过你的办法了。
但扫描的时候 扫描不到条码呢。为什么呢、 ...
Android Zxing 扫描条码实现竖屏模式(portrait mode) 摄像头camera 旋转90度 -
java_ruji:
发送邮件时的速度超级慢??
THinkPHP中利用PHPMailer做邮件发送功能 -
coolxing:
不错的文章,谢谢分享
SQLite数据库约束详解
1、新建工程:DialogTest
2、编写布局文件:
(1)、main.xml 代码如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
<? xml version = "1.0" encoding = "utf-8" ?>
android:orientation = "vertical"
android:layout_width = "fill_parent"
android:layout_height = "fill_parent"
>
< TextView android:layout_width = "fill_parent"
android:layout_height = "wrap_content"
android:text = "@string/hello"
/>
< Button
android:id = "@+id/button01"
android:layout_width = "fill_parent"
android:layout_height = "wrap_content"
android:text = "@string/button01"
/>
< Button
android:id = "@+id/button02"
android:layout_width = "fill_parent"
android:layout_height = "wrap_content"
android:text = "@string/button02"
/>
< Button
android:id = "@+id/button03"
android:layout_width = "fill_parent"
android:layout_height = "wrap_content"
android:text = "@string/button03"
/>
< Button
android:id = "@+id/button04"
android:layout_width = "fill_parent"
android:layout_height = "wrap_content"
android:text = "@string/button04"
/>
</ LinearLayout >
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
<? xml version = "1.0" encoding = "utf-8" ?>
< LinearLayout
android:orientation = "vertical"
android:layout_width = "fill_parent"
android:layout_height = "fill_parent" >
< TextView
android:id = "@+id/username_view"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_marginLeft = "20dip"
android:layout_marginRight = "20dip"
android:text = "用户名"
android:textAppearance = "@android:style/TextAppearance.Medium"
/>
< EditText
android:id = "@+id/username_edit"
android:layout_width = "fill_parent"
android:layout_height = "wrap_content"
android:layout_marginLeft = "20dip"
android:layout_marginRight = "20dip"
android:capitalize = "none"
android:textAppearance = "@android:style/TextAppearance.Medium"
/>
< TextView
android:id = "@+id/password_view"
android:layout_width = "wrap_content"
android:layout_height = "wrap_content"
android:layout_marginLeft = "20dip"
android:layout_marginRight = "20dip"
android:text = "密码"
android:textAppearance = "@android:style/TextAppearance.Medium"
/>
< EditText
android:id = "@+id/password_edit"
android:layout_width = "fill_parent"
android:layout_height = "wrap_content"
android:layout_marginLeft = "20dip"
android:layout_marginRight = "20dip"
android:capitalize = "none"
android:password = "true"
android:textAppearance = "@android:style/TextAppearance.Medium" />
</ LinearLayout >
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
<? xml version = "1.0" encoding = "utf-8" ?>
< resources >
< string name = "hello" >对话框</ string >
< string name = "app_name" >Android Dialog</ string >
< string name = "button01" >两个button的对话框</ string >
< string name = "button02" >三个button的对话框</ string >
< string name = "button03" >可以进行输入的对话框</ string >
< string name = "button04" >进度框</ string >
< string name = "alert_dialog_two_buttons_title" >这是一个提示框,点击取消后可以返回。</ string >
< string name = "alert_dialog_ok" >确定</ string >
< string name = "alert_dialog_cancle" >取消</ string >
< string name = "alert_dialog_three_buttons_title" >标题部分</ string >
< string name = "alert_dialog_three_buttons_msg" >对于程序员或创业团队来说,还是有必要拥有一个属于自己的博客。
Wordpress 曾经让个人或企业搭建博客变得非常容易。但是我们觉得 Wordpress
还是有些重量级,所以选择了一个非常轻便的工具 toto,一段只有200多行代码的Ruby应用程序。</ string >
< string name = "alert_dialog_something" >进入详细</ string >
< string name = "alert_diaog_text_entry" >请输入</ string >
</ resources >
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
package com.dialogTest;
import com.listeview.R;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.app.TimePickerDialog;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.text.method.CharacterPickerDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class DialogTest extends Activity {
private static final int dialog4 = 4 ;
private static final int dialog3 = 3 ;
private static final int dialog2 = 2 ;
private static final int dialog1 = 1 ;
/** Called when the activity is first created. */
private Button button01;
private Button button02;
private Button button03;
private Button button04;
@Override
public void onCreate(Bundle savedInstanceState) {
super .onCreate(savedInstanceState);
setContentView(R.layout.main);
button01=(Button)findViewById(R.id.button01);
button02=(Button)findViewById(R.id.button02);
button03=(Button)findViewById(R.id.button03);
button04=(Button)findViewById(R.id.button04);
button01.setOnClickListener( new OnClickListener() {
@Override
public void onClick(View v) {
showDialog(dialog1);
}
});
button02.setOnClickListener( new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
showDialog(dialog2);
}
});
button03.setOnClickListener( new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
showDialog(dialog3);
}
});
button04.setOnClickListener( new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
showDialog(dialog4);
}
});
}
@Override
protected Dialog onCreateDialog( int id) {
// TODO Auto-generated method stub
switch (id){
case dialog1:
return buildDialog1(DialogTest. this );
case dialog2:
return buildDialog2(DialogTest. this );
case dialog3:
return buildDialog3(DialogTest. this );
case dialog4:
return buildDialog4(DialogTest. this );
}
return null ;
}
private Dialog buildDialog4(Context context) {
ProgressDialog dialog= new ProgressDialog(context);
dialog.setTitle( "正在下载歌曲" );
dialog.setMessage( "请稍候......" );
/*TimePickerDialog dialog=new TimePickerDialog(context, 0, null, 0, 0, false);
dialog.setTitle("时钟");*/
/*DatePickerDialog dialog=new DatePickerDialog(context, 0, null, 0, 0, 0);
dialog.setTitle("日期");*/
return dialog;
}
private Dialog buildDialog3(Context context) {
LayoutInflater inflater=LayoutInflater.from( this );
final View textEntryView=inflater.inflate(R.layout.alert_dialog_text_entry, null );
AlertDialog.Builder builder= new AlertDialog.Builder(context);
builder.setTitle(R.string.alert_diaog_text_entry);
builder.setView(textEntryView); //关键
builder.setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
setTitle( "单击对话框上的确定按钮" );
}
});
builder.setNegativeButton(R.string.alert_dialog_cancle, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
setTitle( "单击了对话框上的取消按钮" );
}
});
return builder.create();
}
private Dialog buildDialog2(Context context) {
AlertDialog.Builder builder= new AlertDialog.Builder(context);
builder.setTitle(R.string.alert_dialog_three_buttons_title);
builder.setMessage(R.string.alert_dialog_three_buttons_msg);
builder.setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
setTitle( "单击对话框上的确定按钮" );
}
});
builder.setNeutralButton(R.string.alert_dialog_something, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
setTitle( "点击了对话框上的进入详细按钮" );
}
});
builder.setNegativeButton(R.string.alert_dialog_cancle, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
setTitle( "单击了对话框上的取消按钮" );
}
});
return builder.create();
}
private Dialog buildDialog1(Context context) {
// TODO Auto-generated method stub
AlertDialog.Builder builder= new AlertDialog.Builder(context);
//builder.setIcon(R.drawable.icon);
builder.setTitle(R.string.alert_dialog_two_buttons_title);
builder.setPositiveButton(R.string.alert_dialog_ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
setTitle( "单击对话框上的确定按钮" );
}
});
builder.setNegativeButton(R.string.alert_dialog_cancle, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// TODO Auto-generated method stub
setTitle( "单击了对话框上的取消按钮" );
}
});
return builder.create();
}
} |
主程序:
Dialog1:
Dialog2:
Dialog3:
Dialog4:
<!--EndFragment-->
发表评论
-
Android开发窗口实现半透明效果
2012-01-17 18:47 16514弹出popwindow的 ... -
Android 获取联系人的姓名、电话信息
2012-01-16 18:29 1154//获取联系人的姓名、电话信息 public ... -
Android中Fragment的应用
2012-01-13 14:36 2003Fragment 表现 Activity ... -
android handlerthread 通知机制
2011-11-15 14:19 5430自从涉足android之日起,越来越觉得android ... -
关于一进入程序就自动执行Spinner的OnItemSelectedListener的问题解决办法
2011-11-04 09:30 1850解决办法就是添加一句话 mySpinner.se ... -
ProgressDialog的dismiss方法与cancel方法的区别
2011-11-04 09:20 6098ProgressDialog,它有两个方法dialog. ... -
进度条的使用 ProgressBar类
2011-11-01 14:04 997布局文件: <?xml version=&q ... -
android: 静态XML和动态加载XML混合使用,以及重写Layout控件
2011-10-26 11:15 1194近期对android里面控件修改做了很多实验,由于公司需 ... -
Android Zxing 扫描条码实现竖屏模式(portrait mode) 摄像头camera 旋转90度
2011-10-25 10:39 10001最近在搞一个关于条形码扫描的软件,需求需要扫描时是竖屏。 ... -
Android图片浏览器:在对话框上实现图片浏览
2011-10-24 16:32 1407前段时间弄了2个Gallery跟ImageSwitche ... -
Android Layout xml 中的几个概念
2011-10-22 11:13 1215Android 文章第一抄,下面的这些东西是转自Andr ... -
Android 之 ProgressDialog
2011-10-22 11:12 909ProgressDialog 类似于ProgressBa ... -
关于Android 设置application的问题
2011-10-21 20:45 753之前尝试过使用application来保存数据,现在再次使用, ... -
Android设置控件,按钮不显示
2011-10-21 17:47 1202Button btn = (Button)findViewBy ... -
Android 监听返回按钮事件
2011-10-21 17:08 1004用户在点击手机的返回按钮时,默认是推出当前的activt ... -
Android 说说EditText里面的属性
2011-10-19 18:46 1041我们今天来说的就是edit ... -
Android 图片平铺效果
2011-10-19 18:38 1904在drawable文件夹中添加自己的my.xml文件,描 ... -
在Android中创建和使用数据库
2011-10-17 20:11 839每个应用程序都要 ... -
如何在eclipse的android工程里引用android sdk之外的类和方法
2011-10-14 15:45 819我们经常会遇到这样 ... -
Android自动化测试工具——Monkey
2011-10-13 17:48 755前言: 最近开始研究Android自动化测试方法,整理了 ...
相关推荐
Android中Dialog从底部划入,在项目中,非常常用,我写了一个例子,放在这希望能和大家交流学习
AndroidDialog工程示例
基于Android的Dialog控件的各种对话框开发示例
本源码主要是展示在Android环境下的用户登录框设计问题,除此之外,没有其它的功能,DialogShow对话框不仅仅在Android环境中使用广泛,其它程序类型也都有广泛使用,本例子尤其是对Android开发新手们友好,可学习到...
这是Pro Android学习dialog部分的例子源代码。
这是一个Android使用Dialog制作popWindow气泡提示框的源代码例子,气泡提示是主动弹出,您可以通过此源码学习制作气泡view、气泡dialog、气泡显示内容的自定义,获取屏幕的宽和高,一些初始化代码: //设置...
android Dialog 各种类型的示例代码,单选对话框,复选对话框,搜索对话框等!
Android例子源码可以通过网络请求内容的自定义列表选择Dialog
本实例是初学Android入门Dialog实例,多个例子,归纳总结,新手必学,举一反三的例子.
在Android的实际开发中dialog和popuwindow,非常常见,但是系统自带的样式已经满足不了我们的项目需求,所以需要我们自定义,这是我自定义的一个例子,希望和大家分享交流
百度地图公共sdk示例源码,小DEMO,还包含自定义Dialog的使用,还有几个公共sdk没做完,日后完善吧,****替换为自己的key
dialog:如何在android中使用dialog对话框,弹出框。 layout:一个布局的例子,主要利用xml文件进行布局,这里边用到的是RelativeLayout。 1.ActivityMain演示了linerLayout。 2.ActivityLayout 演示了...
Android例子源码HerilyAlertDialog完全自定义的Dialog
android dialog 对话框简单示例
通用Dialog例子,Android通用对话框组件设计,稍微修改自己使用。
自定义Dialog对话框(实现类似微信分享对话框),里面有完整的代码实现过程及示例
Dialog也是Android中常用的用户界面元素,他同Menu一样也不是View的子类。让我们看一下它的继承关系: 这里要留意一下他的直接子类 AlertDialog,和间接子类 DatePickerDialog,ProgressDialog,TimePickerDialog,...
本篇文章主要介绍Android Dialog中软键盘的显示与隐藏的示例,这里整理了详细的代码,具有一定的参考价值,感兴趣的小伙伴们可以参考一下。