Coder Social home page Coder Social logo

chanelview's Introduction

ChanelView

废话不多说,请看效果图。

Chanel App效果图 我实现的效果
Chanel App Gif  Chanel View

实现原理介绍

采用的是 竖行的ViewPage 来实现的,相信大家都知道怎么弄,然后就是在ViewPage的transformPage方法里面,里面要怎么样的效果都可以自行修改。

 mVerticalViewPager.setPageTransformer(false, new ViewPager.PageTransformer() {
            @Override
            public void transformPage(View view, float position) {
                int pageHeight = view.getHeight();
                ImageView iv_picture=view.findViewById(R.id.iv_picture);
                if (position < 1) {
                    view.setTranslationY(mOffset * position);
                    //移动文字
                    if (position >= 0) {
                        TextView tv_title2=(TextView) view.findViewById(R.id.tv_title2);
                        TextView tv_sign=(TextView)view. findViewById(R.id.tv_sign);
                        RelativeLayout layout_live_content=(RelativeLayout) view.findViewById(R.id.layout_live_content);

                        tv_title2.setAlpha((1-position));
                        iv_picture.setScaleX((float) ((1-position)*0.2+1));
                        iv_picture.setScaleY((float) ((1-position)*0.2+1));

                        float live_content_offset;
                        //如果在最后一个,则移动到底部50dp
                        if(tv_sign.getText().toString().trim().equals((list.size() -1))){
                            live_content_offset = pageHeight - MainActivity.this.getResources().getDimension(R.dimen.DIMEN_120DP);
                        } else {
                            live_content_offset = pageHeight -  MainActivity.this.getResources().getDimension(R.dimen.DIMEN_300DP);
                        }
                        layout_live_content.setTranslationY(live_content_offset * (1 - position));
                    }
                } else { // (1,+Infinity]
                    view.setTranslationY(-pageHeight * (position - 1) + (mOffset + (position - 1) * (-mOffset / 2)));
                }
            }
        });

喜欢就在 star下,非常感谢o(∩_∩)o~~~

chanelview's People

Contributors

yanxuwen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

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.