PopupWindows全屏及半透明背景代码

ok.setOnClickListener(new OnClickListener() {


@Override
public void onClick(View v) {
View view = getLayoutInflater().inflate(R.layout.pop_queren,
null, false);
pop = new PopupWindow(view, LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT);
pop.setOutsideTouchable(true);
pop.setFocusable(true);
pop.showAtLocation(view, Gravity.CENTER, 0, 0);// 显示屏幕中央
final WindowManager.LayoutParams lp = getWindow()
.getAttributes();
lp.alpha = (float) 0.5;
getWindow().setAttributes(lp);
quxiao = (Button) view.findViewById(R.id.quxiao);
queding = (Button) view.findViewById(R.id.queding);
quxiao.setOnClickListener(new OnClickListener() {


@Override
public void onClick(View v) {
pop.dismiss();
lp.alpha = (float) 1;
getWindow().setAttributes(lp);
}
});
queding.setOnClickListener(new OnClickListener() {


@Override
public void onClick(View v) {
pop.dismiss();
lp.alpha = (float) 1;
getWindow().setAttributes(lp);
}
});
}
});
阅读更多
上一篇android中popupwindow弹出后,屏幕背景变成半透明
下一篇【Android进阶学习】监听EditText的变化
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭