Code Monkey home page Code Monkey logo

assembleessay's Introduction

Release

AssembleEssay

自定义 LayoutManager 实现一个流动布局,可以用作文章展示,也可以用作标签展示,并且可以很方便地为其添加布局动画,示例代码里添加了拖拽插入的动画,如效果图。

对齐方式可选4中:

  1. 向左对齐
  2. 向右对齐
  3. 居中对齐
  4. 两边对齐

默认是两边对齐的布局方式

效果图

image

使用方式

  1. 先添加 jitpack
allprojects {
  repositories {
	 ...
	 maven { url 'https://jitpack.io' }
  }
}
  1. 在 module 对应得 build.gradle 文件中添加
implementation 'com.github.rantianhua:AssembleEssay:v1.0.0'
  1. 示例代码
recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
recyclerView.setLayoutManager(new FlowDragLayoutManager());

设置/更改对齐方式

//初始化是设置
//向左对齐
FlowDragLayoutManager layoutManager = new FlowDragLayoutManager(FlowDragLayoutConstant.LEFT);
//居中对齐
FlowDragLayoutManager layoutManager = new FlowDragLayoutManager(FlowDragLayoutConstant.CENTER);
//向右对齐
FlowDragLayoutManager layoutManager = new FlowDragLayoutManager(FlowDragLayoutConstant.RIGHT);
//居中对齐
FlowDragLayoutManager layoutManager = new FlowDragLayoutManager(FlowDragLayoutConstant.TWO_SIDE);

//动态更改
layoutManager.setAlignMode(FlowDragLayoutConstant.LEFT);
layoutManager.setAlignMode(FlowDragLayoutConstant.CENTER);
layoutManager.setAlignMode(FlowDragLayoutConstant.RIGHT);
layoutManager.setAlignMode(FlowDragLayoutConstant.TWO_SIDE);

优点

  1. 当标签很多的时候,可以重用视图,不会一次性产生过多对象
  2. 基于 RecyclerView 的 LayoutManager , 使用方便,而且添加动画效果也很容易
  3. 对齐方式灵活,目前四种应该n可以满足大部分的需求了

assembleessay's People

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  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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

assembleessay's Issues

SDK 23并不能编译

@Override public void onLayoutCompleted(RecyclerView.State state) { super.onLayoutCompleted(state); DebugUtil.debugFormat("FlowDragLayoutManager onLayoutComplete"); }
比如这样的方法找不到

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.