本文主要介绍如何为应用程序添加基于AlertDialog的对话框,使用DialogFragment呈现该对话框。可以为对话框创建一个标题的string资源,在values/strings.xml中添加字符串str。创建一个DialogFragment,选择android.support.v4.app...
分类:
移动开发 时间:
2015-05-09 11:30:04
阅读次数:
135
图片省略了不上传了。。。
首先看activity_main.xml
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent...
分类:
其他好文 时间:
2015-05-09 06:38:38
阅读次数:
168
主要介绍Android常用于消息提示的组件:ALertDialog、Toast、Notification的使用场景以及它们的基本用法,探讨一些高级主题,最后总结一些开发过程中常见的问题。...
分类:
移动开发 时间:
2015-05-08 22:02:27
阅读次数:
325
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { //按下键盘上返回按钮 if (keyCode == KeyEvent.KEYCODE_BACK) { new AlertDialog.Builder(LoginAct...
分类:
移动开发 时间:
2015-05-07 18:37:59
阅读次数:
131
1 private void exitDialog() { 2 Dialog dialog = new AlertDialog.Builder(this).setIcon(R.drawable.pic_m) 3 .setTitle("程序退出...
分类:
移动开发 时间:
2015-05-05 23:39:15
阅读次数:
194
notification,通知,显示在状态栏那里的信息。它看起来是这样的:
如果想设计更为人性化的notification,可参考android官方的design文档————notification
创建notification
类似于AlertDialog的创建,notification的创建同样也是通过NotificationComp...
分类:
移动开发 时间:
2015-05-04 10:07:58
阅读次数:
403
Android常用实例—Alert Dialog的使用
AlertDialog的使用很普遍,在应用中当你想要用户做出“是”或“否”或者其它各式各样的选择时,为了保持在同样的Activity和不改变用户屏幕,就可以使用AlertDialog.
这篇文章主要讲解如何实现各种AlertDialog,文章比较长,如果能认真读完,AlertDialog的各种用法应该就能掌握了,下面是我们今天要实现的最终效...
分类:
移动开发 时间:
2015-05-01 18:48:29
阅读次数:
156
/***自定义AlertDialog*用于退出程序按钮**/publicclassAlertDialog{ Contextcontext; android.app.AlertDialogad; TextViewtitleView; TextViewmessageView; LinearLayoutbuttonLayout; publicAlertDialog(Contextcontext){ this.context=context; ad=newandroid.app.Aler..
分类:
其他好文 时间:
2015-04-30 09:07:18
阅读次数:
139
安卓自定义AlertDialog,原理很简单:
AlertDialog dialog = new AlertDialog.Builder(MainActivity.this).create();
dialog.show();
Window window = dialog.getWindow();
window.setContentView(R.layout.aler...
分类:
微信 时间:
2015-04-24 12:40:11
阅读次数:
291
添加公用单元文件com..java
package com.example.myapplication;
import android.app.AlertDialog;
import android.content.Context;
import android.widget.Toast;
public class com {
//提示信息
public static void S...
分类:
移动开发 时间:
2015-04-24 12:36:52
阅读次数:
142