/**
* 点击评分,如果评分后,显示的弹出框
*/
private void showMakeGradeMarkedWindow() {
View view = LayoutInflater.from(DetailActivity.this).inflate(
R.layout.grade_screen_marked, null);
final PopupWindow mPopupWindow = new PopupWindow(view, 469, 280);
mPopupWindow.setFocusable(true);
ColorDrawable dw = new ColorDrawable(0xb0000000);
mPopupWindow.setBackgroundDrawable(dw);
mPopupWindow.showAtLocation(install, Gravity.CENTER, 0, 0); final RatingBar mraRatingBar = (RatingBar) view
.findViewById(R.id.grade_screen);
mraRatingBar.setRating(4.5f);
// mraRatingBar.setEnabled(false);
// 设置背景颜色变暗
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.alpha = 0.7f;
getWindow().setAttributes(lp);
mPopupWindow.setOnDismissListener(new OnDismissListener() { @Override
public void onDismiss() {
WindowManager.LayoutParams lp = getWindow().getAttributes();
lp.alpha = 1f;
getWindow().setAttributes(lp);
}
}); }

当popupWindow消失后,监听其消失的方法,让背景恢复原样。

popupWindow弹出来后,背景变暗,半透明的更多相关文章

  1. PopupWindow 弹出时背景变暗

    下面的PopupWindow  的高是相对于屏幕高设计,宽是获取的某一个控件的宽设置,位置位于某控件的上方,红色部分是设置弹出时屏幕变暗的. //设置contentView View contentV ...

  2. 简单 JS 弹出层 背景变暗

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  3. 弹出popwindow 背景变暗

    先看下效果图吧 代码如下 package com.example.administrator.popwindowdemo.view; import android.app.Activity; impo ...

  4. Popupwindow 显示, 其它背景变暗。 并加上点击事件 ~ (用于记录)

    public class MainActivity extends Activity implements OnClickListener { protected int mScreenWidth; ...

  5. 弹出PopupWindow背景变暗的实现

    弹出PopuoWindow后 代码里设置的是PopupWindow默认获取焦点 所以PopupWindow显示的时候其它控件点击是没有反应的 用到的方法是 pwMyPopWindow.setFocus ...

  6. js弹窗 js弹出DIV,并使整个页面背景变暗

    1.首先写一个遮罩层div,然后再写一个弹窗的div <!-- 遮罩层 --> <div id="cover" style="background: # ...

  7. ios-点击图片放大,背景变半透明

    在view中点击一个图片,图片放大,背景变半透明,图片不会变透明的效果图如下 思路:图片框是一个按钮,监听点击事件. 当点击图片后:改变图片的frame,使图片放大,并且在controller.vie ...

  8. Android popupwindow 弹出的位置问题

    在Android开发中,需要用到PopupWindow这个类.在初始化完成,显示之前,都需要获得这个对象的width,height去计算popupWindow弹出的位置. 这个时候会发现取得的widt ...

  9. 练习PopupWindow弹出框之实现界面加载的时候显示弹出框到指定的view下面--两种延迟方法

    今天在练习PopupWindow弹出框的时候,打算在界面加载的时候将弹出框展现出来并显示在指定的view下面. 初步方法是直接在OnResume方法里面直接执行showPopupWindows方法. ...

随机推荐

  1. Winform屏幕截图保存C#代码

    代码如下: using System.Runtime.InteropServices; using System.Drawing.Imaging; [System.Runtime.InteropSer ...

  2. 如何理解css中的float

    最近一段时间一直在为一个即将上线的新站进行一些前端开发.自然,对CSS的使用是必不可少的了.我们在CSS 中很多时候会用到浮动来布局.常见的有 float:left 或者 float:right .简 ...

  3. Java集合Iterator迭代器的实现

    一.迭代器概述 1.什么是迭代器? 在Java中,有很多的数据容器,对于这些的操作有很多的共性.Java采用了迭代器来为各种容器提供了公共的操作接口.这样使得对容器的遍历操作与其具体的底层实现相隔离, ...

  4. C#中的lock关键字有何作用

    作为C#的程序员来说,在遇到线程同步的需求时最常用的就是lock关键字.但如何正确并有效地使用lock,却是能否高效地达到同步要求的关键.正因为如此,程序员需要完全理解lock究竟为程序做了什么. 所 ...

  5. WCF使用泛型方法的问题

    public IList getModelList(string type, string SQL, List<string> list){ try { IList Mlist = new ...

  6. CMS如何提供XML格式的接口

    在做APP的过程中,需要服务端的接口数据. 是用Json格式还是Xml格式呢,很多人会说还是xml习惯. 然而PHP更适合返回的还是json,php核心库中就包含了json编码的函数,可以直接将数组转 ...

  7. Titanium开发环境搭建第三个坑

    Nodejs版本的问题 首先,如下引用:http://docs.appcelerator.com/titanium/latest/#!/guide/Installing_Node To run all ...

  8. ahjesus Unity3D XML注释被编译的问题

    public class XMLStringReader : MonoBehaviour { public string slectedItem; private bool editing = fal ...

  9. Genymotion Shell命令

    命令行选项 •-h 输出帮助信息 •-r ip_address 连接到特定Genymotion虚拟设备 •-c "command" 在原生shell环境中执行给定命令而后返回 •- ...

  10. Python迭代器:捕获Generator的返回值

    但是用for循环调用generator时,发现拿不到generator的return语句的返回值.如果想要拿到返回值,必须捕获StopIteration错误,返回值包含在StopIteration的v ...