Giter Club home page Giter Club logo

android-flowlayout's Introduction

Android-FlowLayout

热门标签,搜索记录标签,流式布局,动态计算每一条目的宽度,当标签在本行展示不开自动切换到下一行展示。支持最大行数,元素内最大字数的限制,每个条目之间的间距设置,字体颜色,元素背景,元素文字左边图片标头显示等,体积小,易上手!!!直接上效果

引入方式:


allprojects {
		repositories {
			...
			maven { url 'https://jitpack.io' }
	    }
   
dependencies {
	        implementation 'com.github.China-Android:Android-SearchFlowLayout:1.0'
	     }

b a

xml引用控件


     < com.example.androidflowlayoutlibrary.MyFlowLayout
        android:id="@+id/fl"
        android:layout_width="match_parent"
        android:layout_height="300dp"
        app:textBackground="@drawable/xxx"
        app:textDrawableLeft="@drawable/xxx"/>
  

1.设置每个条目之间的间距


   fl_layout.setHorizontalMargin(10);
   

2.设置每一行之间的间距


  fl_layout.setVerticalMargin(30);
  

3.设置字体颜色


  fl_layout.setTextColor(R.color.purple_500);
  

4.设置每一条最大字显示体个数,超过部分截取不显示


  fl_layout.setTextMaxLength(10);
  

5.设置文字左面图片


  fl_layout.setTextDrawableLeft(R.drawable.xxx);
  

6.设置列表数据


  fl_layout.setTextList(list);
  

7.设置点击事件


  fl_layout.setOnClickItemListener((v, text) -> {

  });
  

对应也可在xml中进行相关属性设置


  itemHorizontalMargin = "10"
  itemVerticalMargin = "10"
  textMaxLength = "3"
  textColor = "@color/xxx"
  textDrawableLeft="@drawable/c"
 

应用户要求我的流式布局v1.1版本他来了!!!---------------------------------------------------------------------------

增加每个条目支持添加不同图片,长按可以删除对应条目

v1 1 v1 1_close
数据方法有所改变,接收的是一个FlowDataBean类型的数据集合:itemText代表要显示的文字,drawableId代表要显示图片的id
1.长按删除条目监听


 fl_layout.setOnClickLongDelItemListener((v, text, pos) -> {

 });
 

*注意当在xml单独设置左面图片时,优先级是大于数据集合中类型所设置图片的优先级。

android-flowlayout's People

Contributors

china-android 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.