Git Product home page Git Product logo

simplegridlayout's Introduction

SimpleGridLayout

用途:根据指定的列数对子view们按顺序布局

最基本的效果图,更多*操作可以在item上做文章

用法

Step1. 继承SimpleGridLayoutAdapter

        class SimpleGridLayoutAdapter extends SimpleGridLayout.SimpleGridLayoutAdapter

Step2. 实现方法

        //指定列数
        public abstract int getItemColumns();
        //准备要显示的view们
        public abstract List<View> getItemViews(Context context);
       

Step3. setAdapter

        grid.setAdapter(adapter)

其他设置

  • 指定某个item跨过的列数,可以是小数,但是要保证那一行的总列数不超过上面设定的列数,否则会有部分item显示不全,不写的话默认为1
        @Override
        public int getItemWeight(int position) {
            return 1;
        }
  • 如果adapter内数据发生变化可以手动通知Layout进行重新布局
        //调用一下这个就可以了
        notifyDataSetChanged()

simplegridlayout's People

Contributors

nelson1110 avatar

Stargazers

 avatar

Watchers

James Cloos 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.