GithubHelp home page GithubHelp logo

albert-lii / flowview Goto Github PK

View Code? Open in Web Editor NEW
20.0 0.0 7.0 2.05 MB

:sailboat:FlowView是一款流布局控件,采用Adapter模式,可以自定义item,更加灵活,使用起来就和ListView与BaseAdapter搭配一样简单,提供各种对齐方式,可以自适应 高度,也可以设置item的高度,可以控制item的最大显示行数...

Home Page: https://github.com/albert-lii/FlowView

Java 100.00%
flowlayout flowview android taglayout tagview tag

flowview's Introduction

FlowView

releasesvg apisvg license

关于

FlowView是一款流布局控件,采用Adapter模式,可以自定义item,更加灵活,使用起来就和ListView与BaseAdapter搭配一样简单,提供各种对齐方式,可以自适应高度,也可以设置item的高度,可以控制item的最大显示行数...

演示

先来看看效果吧!

演示

添加依赖

  • 使用Gradle
  // 注:如果添加依赖成功,则此句不必添加,此句作用仅为当项目在被审核时,紧急需要使用时添加
   allprojects {
       repositories {
           ...
           // 如果添加依赖时,报找不到项目时(项目正在审核),可以添加此句maven地址,如果找到项目,可不必添加
           maven { url "https://dl.bintray.com/albertlii/android-maven/" }
       }
    }
    
    dependencies {
         compile 'com.liyi.view:flowview:1.2.2'
    }
  • 使用Maven
 <dependency>
   <groupId>com.liyi.view</groupId>
   <artifactId>flowview</artifactId>
   <version>1.2.2</version>
   <type>pom</type>
 </dependency>

自定义属性

  • flow_horizontalAlign(item 在一行中的横向对齐方式,默认为 left)  - left(item 左对齐)

    • middle(item 横向居中对齐)
    • right(item 右对齐)
  • flow_verticalAlign(item 在一行中的纵向对齐方式,默认为 middle,当设置 flow_height 时,此属性无效)  

    • top(item 上对齐)
    • middle(item 纵向居中对齐)
    • bottom(item 底部对齐)
  • flow_height(流布局的 item 的高度,默认为自适应)

  • flow_horizontalSpace(流布局的 item 横向间距,默认为 10px)

  • flow_verticalSpace(流布局的 item 纵向间距,默认为 10px)

  • flow_maxRow(流布局最多显示的行数,默认为不限制)

使用方法

XML 中 添加 FlowView

 <com.liyi.flow.FlowView
    android:id="@+id/flowVi"
    android:layout_width="match_parent"
    android:layout_height="wrap_content" />

代码中使用 FlowView

三种适配器

简单示例

注:此处使用的是 SimpleFlowAdapterSimpleFlowAdapter 必须设置 setLoadData() 来处理数据
 mAdapter = new SimpleFlowAdapter(mList);
 mAdapter.setLoadData(new SimpleFlowAdapter.LoadData<String>() {
      @Override
      public void onLoadData(int position, String item, TextView textView) {
           textView.setText(item);
      }
});
flowView.setAdapter(mAdapter);
// 单击事件
flowView.setOnItemClickListener(new FlowView.OnItemClickListener() {
    @Override
    public void onItemClick(int position, View view) {
        Toast.makeText(SimpleFlowActivity.this, "我是" + position + "号", Toast.LENGTH_SHORT).show();
    }
});

赞赏

如果你感觉 FlowView 帮助到了你,可以点右上角 "Star" 支持一下哦!:blush:

LICENSE

Copyright 2017 liyi

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

flowview's People

Contributors

albert-lii avatar

Stargazers

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

flowview's Issues

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.