Git Product home page Git Product logo

Comments (7)

myheed avatar myheed commented on August 20, 2024 2

大神就坐我旁边!

from weibo.

wenmingvs avatar wenmingvs commented on August 20, 2024

其实你看到的并不是背景变半透明了,而是盖在上面的那张ImageView是半透明的背景。对那张半透明的ImageView做透明度动画就可以了。

from weibo.

zaaach avatar zaaach commented on August 20, 2024

就是整个popwindow背景的透明度吗?

from weibo.

wenmingvs avatar wenmingvs commented on August 20, 2024

http://stackoverflow.com/questions/6839683/windowmanager-with-animation

尝试使用这个来给windowmanager加入渐变动画

mParams.windowAnimations = android.R.style.Animation_Toast;

我在后期会抽空加入这个渐变动画,你也可以到我的源码中查阅

from weibo.

zaaach avatar zaaach commented on August 20, 2024

恩好,谢谢啦

from weibo.

wenmingvs avatar wenmingvs commented on August 20, 2024

@xiangflight 这位大神已经把背景阴影动画加上啦。主要在这个ImageDetailsActivity类里面,代码不到20行

我贴上关键代码供你参考哦。请Update一下项目代码到最新,看下效果

/**
     * 调整窗口的透明度
     *
     * @param from
     * @param to
     */
    private void setOutBackground(float from, float to) {
        final WindowManager.LayoutParams lp = getWindow().getAttributes();
        ValueAnimator valueAnimator = ValueAnimator.ofFloat(from, to);
        valueAnimator.setDuration(600);
        valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                lp.alpha = (float) animation.getAnimatedValue();
                getWindow().setAttributes(lp);
            }
        });
        valueAnimator.start();
    }

from weibo.

zaaach avatar zaaach commented on August 20, 2024

太好啦,学习了

from weibo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.