- 浏览: 3897662 次
- 性别:
- 来自: 北京
文章分类
最新评论
-
hinuliba:
...
字体背景颜色的高度修改 -
KANGOD:
最后的 -createDialog() 私有方法是怎么回事,没 ...
简单的实现listView中item多个控件以及点击事件 -
sswangqiao:
呵呵,呵呵
onActivityResult传值的使用 -
yumeiqiao:
感觉你所的不清楚 lstView.setOnTouchLi ...
listview中viewflipper的问题 -
lizhou828:
果然是大神啊!!!
Animation动画效果的实现
styles.xml
<style name="NewBorderDialogTheme" parent="android:Theme.Dialog"> <item name="android:windowBackground">@drawable/your_drawable/item> </style>
import android.app.AlertDialog;
import android.content.Context;
import android.content.res.TypedArray;
import android.content.res.Resources.Theme;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.ImageView;
public class MyColorDialog extends AlertDialog{
private static int NONE = -1;
private int tint = NONE;
/**
* @param context
* @param theme
*/
protected MyColorDialog(Context context) {
super(context);
init();
}
/**
* @param context
* @param theme
*/
protected MyColorDialog(Context context, int theme) {
super(context, theme);
init();
}
/**
*
*/
private void init() {
final Theme theme = getContext().getTheme();
final TypedArray attrs = theme.obtainStyledAttributes(new int[] { android.R.attr.tint });
tint = attrs.getColor(0, NONE);
}
@Override
public void show() {
// TODO Auto-generated method stub
super.show();
setTint(tint);
}
public void setTint(int tint) {
// TODO Auto-generated method stub
this.tint = tint;
android.graphics.PorterDuff.Mode mode = PorterDuff.Mode.SRC_ATOP;
final Drawable d = this.getWindow().getDecorView().getBackground();
d.mutate().setColorFilter(tint, mode);
}
/**
* @param button
*/
public void setCancelButton(Button button) {
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
cancel();
}
});
}
/**
* @param button
*/
public void setPositiveButton(Button button) {
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dismiss();
}
});
}
public static class Builder extends AlertDialog.Builder {
private MyColorDialog dialog;
public Builder(Context context) {
super(context);
dialog = new MyColorDialog(context);
}
public Builder(Context context, int theme) {
super(context);
dialog = new MyColorDialog(context, theme);
}
@Override
public MyColorDialog create() {
return dialog;
}
@Override
public Builder setMessage(CharSequence message) {
dialog.setMessage(message);
return this;
}
@Override
public Builder setTitle(CharSequence title) {
dialog.setTitle(title);
return this;
}
@Override
public Builder setPositiveButton(CharSequence text,
OnClickListener listener) {
dialog.setButton(BUTTON_POSITIVE, text, listener);
return this;
}
@Override
public Builder setIcon(int iconId) {
dialog.setIcon(iconId);
return this;
}
}
}
使用
new MyColorDialog.Builder(this, R.style.OrangeDialogTheme).setPositiveButton("Dismiss", null).setTitle("Warning").setMessage("adhuhfdu").create().show();
<?xml version="1.0" encoding="utf-8"?> <resources> <color name="red_tint">#88FF0000</color> <color name="blue_tint">#880000FF</color> <color name="yellow_tint">#88FFFF00</color> <color name="purple_tint">#88995f86</color> <color name="orange_tint">#aaffbf00</color> <color name="magenta_tint">#88ff33cc</color> <color name="transparent">#0000</color> </resources>
<?xml version="1.0" encoding="utf-8"?> <resources> <!-- Orange --> <style name="OrangeDialogTheme" parent="@android:style/Theme.Dialog"> <item name="android:tint">@color/orange_tint</item> <item name="android:windowBackground">@color/orange_tint</item> </style> <style name="OrangeAlertDialogTheme" parent="OrangeDialogTheme"> <item name="android:windowBackground">@color/transparent</item> </style> <!-- Red --> <style name="RedDialogTheme" parent="@android:style/Theme.Dialog"> <item name="android:tint">@color/red_tint</item> </style> <style name="RedAlertDialogTheme" parent="RedDialogTheme"> <item name="android:windowBackground">@color/magenta_tint</item> </style> </resources>
发表评论
-
URI 转path
2019-06-26 10:41 1211转自知乎Matisse package com.zhihu ... -
权限申请
2017-09-22 13:25 1217public class PermissionActivit ... -
onPreviewFrame 相机输出格式转换yuv420p保存成图片
2015-11-25 15:59 7475在最近项目中,因为特殊需要,底层相机往外输出了i420 也 ... -
new Android's Runtime Permission
2015-11-03 21:05 1187targetSdkVersion 23 开始 使用运行时权 ... -
自定义listview 边缘效果
2015-02-28 10:58 1692static void ChangeEdgeEffect( ... -
发射打开wifi
2015-01-07 10:25 1367WifiManager wifiManager = (Wif ... -
RecyclerView
2014-11-05 13:08 1203http://www.grokkingandroid.com ... -
获取点击区域
2014-04-28 09:39 1511@Override public void getHitR ... -
speex 和libogg 编译
2014-04-03 16:17 6362下载: http://www.speex.org/down ... -
rsync 同步
2014-03-28 17:06 1794两台android 设备 进行rsy ... -
流转字符串
2014-03-11 09:49 1472public static String convertSt ... -
java simplexml 序列化
2014-03-06 13:22 5877<?xml version="1.0&quo ... -
获取其他程序的特定资源
2014-03-05 09:33 1650try { PackageManager man ... -
检测来电属于哪个sim卡
2014-02-07 10:41 1671public class IncomingCallInter ... -
使用 NDK r9 编译ffmpeg
2014-01-16 13:32 167491. 环境 ubuntu 我的是13.10 ndk r9 ... -
android h264含so
2014-01-13 11:24 1499http://download.csdn.net/downlo ... -
xml转义字符
2013-12-18 09:29 1550" " ' & ... -
字体背景颜色的高度修改
2013-12-11 10:31 4130当使用android:lineSpacingExtra= ... -
屏保的实现
2013-12-07 10:27 2710最近需要做一个屏保,开始以为很简单,因为系统本身就带了屏保功 ... -
PreferenceActivity下嵌套PreferenceScreen在其它布局中
2013-11-21 16:32 9095今天在修改系统代码的时候,系统代码用了PreferenceA ...
相关推荐
实现了用自己定义的布局,自定义修改dialog弹出框的背景
Android之修改AlertDialog对话框及使用系统Holo风格
Android应用源码之dialog去除边框代码_dialog
仿ios苹果样式的alertdialog,还有带有计时器的dialog,直接调用使用, 封装好了
安卓使用弹框做到倒计时的用法,分别使用MaterialDialog、AlertDialog来做了一个小demo
Android Dialog设置透明背景以及位置
Dialog对话框的使用 (progressDialog、AlertDialog、点击不消失、进度条) 具体可参考我文章:https://blog.csdn.net/qq_28056277/article/details/84591086 【更新-->下载所需积分太高,更改为固定分值了】
各种android弹出dialog效果以及各种dialog样式各种android弹出dialog效果以及各种dialog样式各种android弹出dialog效果以及各种dialog样式各种android弹出dialog效果以及各种dialog样式各种android弹出dialog效果...
去掉 android dialog 白色边框
有些朋友碰到过需要自定义dialog的情况,比如随着安卓应用要求的需要,改变dialog的边框和背景,本安卓源码例子即给你介绍了此作用
dialog去除边框代码
MFC 给 Dialog 添加bmp背景图片 图片大小随窗体拉伸改变 不产生闪烁
提供了完整的Android对话框Dialog详细代码,可直接运行。内容包括确认对话框,列表对话框,单选对话框,多选对话框,自定义对话框。
Google官方推荐使用DialogFragment代替AlertDialog,很好的解决屏幕旋转产生的问题。。。
android的alert dialog,一个漂亮的材料警告对话框,可以在你的android应用程序中使用。
提供形式多变的进度段画框,支持gif图片,可以自定义任何gif格式的进度图片
NULL 博文链接:https://2528.iteye.com/blog/1123944
改变对话框背景颜色
去除Dialog黑边并替换背景,两种方式 一种使用Dialog 一种使用Activity的属性
dialog 背景透明 可以显示背景的形状