更改背景颜色时显示弹出 [英] Change background color when a Popup is shown
本文介绍了更改背景颜色时显示弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我要让背景暗的一个 PopupWindow
显示时。就像海豚浏览器确实喜欢 -
I want to make the background darker when a PopupWindow
is shown. Just like Dolphin Browser does like-
的PopupWindow之前
后PopupWindow
背景颜色比它是什么颜色较深。那么,我们怎样才能做到这一点?
The background color is darker than what it was. So, how can we do this?
推荐答案
在你的XML文件中添加这样的事情宽度和高度为match_parent。
In your xml file add something like this with width and height as 'match_parent'.
<RelativeLayout
android:id="@+id/bac_dim_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#C0000000"
android:visibility="gone" >
</RelativeLayout>
在您的活动的OnCreate
In your activity oncreate
//setting background dim when showing popup
back_dim_layout = (RelativeLayout) findViewById(R.id.bac_dim_layout);
最后使人们看到,当你展示你popupwindow并使其可见走了,当你退出popupwindow。
Finally make visible when you show your popupwindow and make its visible gone when you exit popupwindow.
back_dim_layout.setVisibility(View.Visible);
back_dim_layout.setVisibility(View.GONE);
这篇关于更改背景颜色时显示弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文