Dialog_ _dialog系统样式讲解 及 透明背景

AlertDialog.Builder builder = new AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_TRADITIONAL);//传统主题

AlertDialog.Builder builder = new
AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_HOLO_DARK);//使用深色背景主题

AlertDialog.Builder builder = new
AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_HOLO_LIGHT);//使用浅色背景 主题

AlertDialog.Builder builder = new
AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_DEVICE_DEFAULT_DARK);//使用默认设备深色主题

AlertDialog.Builder builder = new
AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_DEVICE_DEFAULT_LIGHT);//使用默认设备 浅色主题

//自定义布局

View layout =
getActivity().getLayoutInflater().inflate(R.layout.mydialog,null);

AlertDialog.Builder dialog =
new AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_DEVICE_DEFAULT_DARK);

final AlertDialog dialog = builder.create();

dialog.setView(layout);

//透明

Window window = dialog.getWindow();

WindowManager.LayoutParams lp =
window.getAttributes();

lp.alpha = 0.9f;

window.setAttributes(lp);

。。。

dialog.show();

时间: 2024-08-10 21:29:56

Dialog_ _dialog系统样式讲解 及 透明背景的相关文章

Android Dialog 系统样式讲解及透明背景

  AlertDialog.Builder builder = new AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_TRADITIONAL);//传统主题 AlertDialog.Builder builder = new AlertDialog.Builder(DialogActivity.this,AlertDialog.THEME_HOLO_DARK);//使用深色背景 主题 AlertDialog.Builder b

我的Android进阶之旅------>Android中Dialog系统样式讲解

今天在维护公司的一个APP的时候,有如下场景. 弹出一个AlertDialog的时候,在系统语言是中文的时候,如下所示: 弹出一个AlertDialog的时候,在系统语言是English的时候,如下所示: 可以发现在系统语言为英语的时候,对话框中的白色文字已经完全看不清楚,对话框的背景颜色也变成了白色.因此需要修改对话框的主题. 修改之前代码如下: AlertDialog commedialog = new AlertDialog.Builder( WalkieTalkieActivity.th

输入金额,SpannableStringBuilder,Dialog无主题和透明背景的使用

转载请注明出处:http://blog.csdn.net/forwardyzk/article/details/43308573 整理了开发汇中遇到的一些小细节. 1.在EditText中输入金额,只能输入正确的金额格式,例如:0.01,0.1,0,123,123.0,123.01 activity_main.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:too

Android给TextView和EditText等控件设置透明背景、圆角边框

第一种方法:在drawable文件夹下新建一个文件设置背景样式 代码: 在drawable文件夹下面新建textviewborder.xml <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#80858

如何让字体显示在透明背景之上

opacity透明在网页制作中使用会很多,为了增加好看的效果,透明的样式肯定是必不可少的. 记得之前做一个网页,其中一个块给了个30的高,背景半透明的黑色,上面有一排导航,导航字体的颜色也就成了灰黑色,本来是想做成白色字体,怎么改都不行,以为是字体的ul层在背景块的下面,想用z-index把字体的层高提高,但是没用. 那时候还不知道opactiy它的应用或者说是代码书写格式分为两种,一种是用opacity取值0-1之间:想要内容显示在透明背景的上面,不同背景一起变透明,就需要直接使用rgba(0

怎样让字体显示在透明背景之上

opacity透明在网页制作中使用会很多,为了增加好看的效果,透明的样式肯定是必不可少的. 记得之前做一个网页,其中一个块给了个30的高,背景半透明的黑色,上面有一排导航,导航字体的颜色也就成了灰黑色,本来是想做成白色字体,怎么改都不行,以为是字体的ul层在背景块的下面,想用z-index把字体的层高提高,但是没用. 那时候还不知道opactiy它的应用或者说是代码书写格式分为两种,一种是用opacity取值0-1之间:想要内容显示在透明背景的上面,不同背景一起变透明,就需要直接使用rgba(0

Android给TextView设置透明背景、圆角边框

第一种方法:在drawable文件夹下新建一个文件设置背景样式 代码: 在drawable文件夹下面新建text_view_border.xml [java] view plaincopy <?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid an

vc实现透明位图,透明背景

vc实现透明位图,透明背景 我们在进行程序的界面设计时,常常希望将位图的关键部分,也既是图像的前景显示在界面上,而将位图的背景隐藏起来,将位图与界面很自然的融合在一起,本文介绍了透明位图的制作知识,并将透明位图在一个对话框中显示了出来. 一.实现方法 绘制"透明"位图是指绘制某一位图中除指定颜色外的其余部分,我们称这种颜色为"透明色".通过将位图的背景色指定为"透明色",在绘制时,不绘制这部分背景,而仅绘制图像,这样就可以将位图中图像透明地绘制到

C# 透明背景Panel, 透明图像, PitureBox透明效果

1.自定义透明 背景Panel控件:在项目中添加类TransparentPanel.cs using System.Windows.Forms; using System.Drawing; public class TransparentPanel : Control { public TransparentPanel(){} protected override void OnPaintBackground(PaintEventArgs e) { //不进行背景的绘制 } protected