Coder Social home page Coder Social logo

flowview-master's Introduction

在写该文章之前自己也写了一个用RecyclerView实现的流式布局RecyclerView实现的流式布局,也得到一些关注,但是也有不少的朋友提出了相关的问题,比如想规定行数的流式布局,还有item高度不统一时动态显示item的位置问题。于是近两天就简单写了个ViewGroup实现的流式布局:

这里在时给出了四种情况的用例:

(一)文字统一高度,也就是默认的情况

默认情况.gif

这里详见:NormalLoadActivity

(二)不同高度的文本,没设置居中显示的情况

不同高度的文本,没设置居中显示的情况.gif

这里详见:DiffHeightTextActivity

(三)不同高度的文本,设置居中显示的情况

不同高度的文本,设置居中显示的情况.gif

这里详见:DiffHeightTextCenterActivity

(四)规定行数的流式布局

规定行数的文本.gif

这里详见:LineFlowActivity

属性:

 <declare-styleable name="FlowLayout">
        <!--文本是否居中-->
        <attr name="is_line_center" format="boolean" />
 </declare-styleable>

<declare-styleable name="LineFlowLayout">
        <!--规定行数-->
        <attr name="flow_line_count" format="integer" />
</declare-styleable>

<declare-styleable name="ScrollFlowLayout">
        <!--上边界阴影颜色-->
        <attr name="effect_top_color" format="color" />
        <!--下边界阴影颜色-->
        <attr name="effect_bottom_color" format="color" />
        <!--滑动到顶部或底部是否需要阴影效果-->
        <attr name="need_effect" format="boolean" />
</declare-styleable>

1.1版本: 修复规定行数时从网络加载数据显示问题

gradle依赖

allprojects {
        repositories {
                ...
                maven { url 'https://jitpack.io' }
        }
}

dependencies {
        compile 'com.github.1002326270xc:FlowView-master:v1.1'
}

后期添加(自带滑动结构的流式布局):

自带滑动结构的流式布局.gif

这里详见:ScrollFlowActivity thanks: 这里滑动的处理借鉴的SuitLines(一个图标控件)、SwipeDelMenuLayout(侧拉菜单)

欢迎大家提出问题,留言板留言或邮箱直接联系我。我会第一时间测试相关的bug

欢迎客官到本店光临(qq群):

关于我:

email: [email protected]

csdn:enter

简书:enter

flowview-master's People

Contributors

xiangcman avatar

Watchers

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