Need help with BlurPopupWindow?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

128 Stars 27 Forks Apache License 2.0 34 Commits 6 Opened issues


PopupWindow with blurred background.

Services available


Need anything else?

Contributors list

# 13,058
28 commits
# 689,873
1 commit


BlurPopupWindow is not actually a sub-class of PopupWindow. But we did run into some requirements that display a popup in current page with blurred background. Or you may want to display a custom dialog and you are in trouble with the difficulty and diffrent-result through different sdk version and roms. It is possible to just put a simple custom View in current Window and do not bring that lots of other things in?

BlurPopupWindow is more like a pattern to implement these custom popup windows. By default BlurPopupWindow contains nothing but a blurred background. You need to, and actually this is just you want, design all the content and maybe custom the animation.



  • Blur/Not blur background.
  • Support translucent status bar and translucent navigationbar.
  • Tint color.

Use with Gradle

dependencies {
    compile 'com.kyleduo.blurpopupwindow:blurpopupwindow:1.0.9'

Enable support render script

android {
  defaultConfig {
    renderscriptTargetApi 25
    renderscriptSupportModeEnabled true


A typically usage would be like this:

new BlurPopupWindow.Builder(v.getContext())
        .bindClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                Toast.makeText(v.getContext(), "Click Button", Toast.LENGTH_SHORT).show();

And this would display a dialog-like popup window like(1). The content display depends on you layout design.

The blur effect is not that necessay and you can disable it by setting the

. And you got(2)

Or you can tune the blur effect to what you want, like (3).


The Builder class has some methods for change the behavior. Most of them are easy to understand by their name.

// draw a color over background to dim, lighten, or coloring the background.
// bind click listener to id1, id2, ...
.bindClickListener(listener, id1, id2, ...)
// bind click listener to content view


As I mentioned before, BlurPupupWindow does not contains any content view. so you need to create one.

The suggested way to customize a content is to create a class extends from BlurPopupWindow. And there are some methods for you to override. The source code of 3rd demo above would be like this.

There are some points you need to know:

  • Create Builder class exten BlurPopupWindow.Builder and set generic type to your class.
  • In Builder class, override createPopupWindow method and return corrent instance.
  • You can override
    to add your own animation.
  • createShowAnimator()
    return alpha animation by default, override them and return null if you do not like that.
public class SharePopup extends BlurPopupWindow {

public SharePopup(@NonNull Context context) {

protected View createContentView(ViewGroup parent) {
    View view = LayoutInflater.from(getContext()).inflate(R.layout.layout_bottom_popup, parent, false);
    LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    lp.gravity = Gravity.BOTTOM;
    return view;

protected void onShow() {
    getContentView().getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        public void onGlobalLayout() {

            int height = getContentView().getMeasuredHeight();
            ObjectAnimator.ofFloat(getContentView(), "translationY", height, 0).setDuration(getAnimationDuration()).start();

protected ObjectAnimator createShowAnimator() {
    return null;

protected ObjectAnimator createDismissAnimator() {
    int height = getContentView().getMeasuredHeight();
    return ObjectAnimator.ofFloat(getContentView(), "translationY", 0, height).setDuration(getAnimationDuration());

public static class Builder extends BlurPopupWindow.Builder<sharepopup> {
    public Builder(Context context) {

    protected SharePopup createPopupWindow() {
        return new SharePopup(mContext);



##---------------Begin: proguard configuration for RenderScript  ----------
-keep class** { *; }
##---------------End: proguard configuration for RenderScript  ----------


Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.