带你实现ViewGroup规定行数、item居中的流式布局
来源:互联网 发布:物理虚拟实验室软件 编辑:程序博客网 时间:2024/06/08 10:36
在写该文章之前自己也写了一个用RecyclerView
实现的流式布局RecyclerView实现的流式布局,也得到一些关注,但是也有不少的朋友提出了相关的问题,比如想规定行数的流式布局,还有item高度不统一时动态显示item的位置问题。于是近两天就简单写了个ViewGroup
实现的流式布局:
这里在时给出了四种情况的用例:
(一)文字统一高度,也就是默认的情况
这里详见:NormalLoadActivity
(二)不同高度的文本,没设置居中显示的情况
这里详见:DiffHeightTextActivity
(三)不同高度的文本,设置居中显示的情况
这里详见:DiffHeightTextCenterActivity
(四)规定行数的流式布局
这里详见: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>
gradle依赖
allprojects { repositories { ... maven { url 'https://jitpack.io' } }}dependencies { compile 'com.github.1002326270xc:FlowView-master:v1.0'}
后期添加(自带滑动结构的流式布局):
这里详见:ScrollFlowActivity
thanks:这里滑动的处理借鉴的SuitLines(一个图标控件)、SwipeDelMenuLayout(侧拉菜单)
关于我:
email: a1002326270@163.com
简书:enter
github:enter
阅读全文
0 0
- 带你实现ViewGroup规定行数、item居中的流式布局
- Android使用ViewGroup实现流式标签布局(靠左,靠右,居中)
- 自定义ViewGroup实现流式布局FlowLayout
- Android 自定义ViewGroup 实现流式布局
- Android自定义ViewGroup实现流式布局
- 自定义ViewGroup实现流式布局
- 自定义ViewGroup实现流式布局
- 自定义viewGroup 实现 流式布局
- 自定义ViewGroup实现流式布局
- 流式布局FlowLayout以及动态添加Item的实现
- Android自定义ViewGroup之流式布局的实现
- 自定义ViewGroup容器,实现自动换行的流式布局的效果
- Android自定ViewGroup实现流式布局
- android 自定义ViewGroup实现流式布局过程
- android 自定义控件--用viewGroup实现流式布局
- 自定义ViewGroup实现view的自由布局
- 自定义viewgroup流式布局
- viewgroup实现item拖动效果
- hadoop Checksum校验的一个小问题
- Tomcat 7 下对 JSP 进行预编译
- substring()和slice()的区别
- "_OBJC_CLASS_$_WKWebView", referenced from:"...and "linker command failed with exit code 1 (use -v "
- bzoj2251[2010Beijing Wc]外星联络 后缀数组
- 带你实现ViewGroup规定行数、item居中的流式布局
- Android之网络技术
- A-Fast-RCNN: Hard positive generation via adversary for object detection
- soap实例
- 消息队列
- 在linux下配置ipv6 互通libvirt
- 泛型与非泛型组合
- 关于Activity跳转另一个Activity指定的fragment的解决方法
- 闭关修炼之struts2框架1