android瀑布流AndroidStaggeredGrid

开源项目:https://github.com/etsy/AndroidStaggeredGrid

成都创新互联公司主营大方网站建设的网络公司,主营网站建设方案,成都app开发,大方h5微信平台小程序开发搭建,大方网站营销推广欢迎大方等地区企业咨询

分享一下我用过之后,觉得最关键的地方。
在给出的demo中有一个集合,记录每个位置的HeightRatio。设置Dyn/amicHeightTextView和DynamicHeightImageView的HeightRatio来控制显示的高度。
比如在DynamicHeightImageView中有一段代码来设置p_w_picpathview的显示高度:
     

protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {

        if (mHeightRatio > 0.0) {

            // set the p_w_picpath views size

            int width = MeasureSpec.getSize(widthMeasureSpec);

            int height = (int) (width * mHeightRatio);

            setMeasuredDimension(width, height);

        }

        else {

            super.onMeasure(widthMeasureSpec, heightMeasureSpec);

        }

    }  

了解这几点之后,就能够显示出高低不一样的图片效果


本文题目:android瀑布流AndroidStaggeredGrid
URL链接:http://pwwzsj.com/article/psdgpd.html