FlowLayout遇到的坑
来源:互联网 发布:c语言boolean的用法 编辑:程序博客网 时间:2024/06/05 15:44
最近用到流式布局,用的是鸿洋大神的FlowLayout,用的过程中,出现了一些问题,因为我们产品的无理要求,我们的有的item 会显示超过一行,故使用会出现这样的问题,我的item的布局是这样定义的:
<TextView xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="14sp" android:textColor="#ff0000" android:maxLines="1" android:ellipsize="end" android:background="@drawable/tag_bg_select" android:padding="10dp" android:layout_marginTop="12dp" android:layout_marginRight="12dp" android:layout_marginLeft="12dp" />
我的运行效果
会发现这个会超出,也许你那没遇到,你现在在你的item的设置marginLeft和marginRight同时设置看看效果会不会和我的一样;
源码的确没考虑单item超过一行的情况,所以针对这个情况,就重新测量一次,是以计算margin之后的计算,因为这时候一行就一个item,所以可以算上margin ;
你可以这样写
这样可以解决问题,或者你可以设置你的textview的最大的长度
需要的距离自己在调,就可以了,就说到这吧!!!
阅读全文
1 0
- FlowLayout遇到的坑
- FlowLayout的使用
- FlowLayout的使用
- FlowLayout
- FlowLayout
- FlowLayout
- FlowLayout
- FlowLayout
- FlowLayout
- FlowLayout
- JavaSwing布局FlowLayout的用法
- Android Flowlayout实现的说明
- 学习篇---FlowLayout的实现
- 自动换行的ViewGroup:FlowLayout
- 自动换行的ViewGroup:FlowLayout
- FlowLayout的布局组件的流向
- Android自定义控件---打造不一样的FlowLayout
- 如何实现FlowLayout的换行操作
- NOI2017 退役记
- PS
- SpringMVC —— @RequestParam @RequestBody @PathVariable 等参数绑定
- mycat分布式mysql中间件(分片规则)
- C语言阶乘level1.0
- FlowLayout遇到的坑
- TNS-12545: Connect failed because target host or object does not exist
- 4. Median of Two Sorted Arrays 详细解答
- Choosing the Right Cisco Compatible SFP Transceivers for Your Network
- 百练_4045:与3和5无关的数
- getParameter获取整数值
- JAVA、C# DES通用加解密
- MySQL5.7.19Win10免安装配置+登录+问题解决
- 百练_4067:回文数字(Palindrome Number)