- 浏览: 1209468 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (353)
- java基础 (40)
- tapestry (16)
- gwt (14)
- ajax (7)
- linux (8)
- ubuntu (18)
- eclipse (6)
- dojo (2)
- javascript (7)
- maven (4)
- 日常生活 (29)
- web2.0 (2)
- jsonrpc (1)
- compass (1)
- lucene (0)
- spring (10)
- cluster (3)
- 数据结构 (2)
- sqlserver (1)
- tomcat (2)
- swing (1)
- servlet (1)
- hibernate (1)
- firefox (1)
- Java-Puzzlers (1)
- Wicket (2)
- mysql (10)
- windows (5)
- Webwork (1)
- struts2 (1)
- Seam (2)
- jboss (1)
- idea (6)
- 分布计算 (3)
- Python-Django (7)
- Hadoop (1)
- 工具 (3)
- Tokyo Tyrant (2)
- Comet (1)
- android (115)
- 音乐 (6)
- cxf (1)
- mqtt (1)
最新评论
-
hesai_vip:
学习了,感谢
gradlew wrapper使用下载到本地的gradle.zip文件安装。 -
imknown:
姚瑶大坏蛋 写道我也遇到了这个,用你这个方法,导致下拉刷新不起 ...
解决android-Ultra-Pull-To-Refresh下拉刷新组件中嵌套ViewPager的一个bug -
姚瑶大坏蛋:
我也遇到了这个,用你这个方法,导致下拉刷新不起作用了,你遇到过 ...
解决android-Ultra-Pull-To-Refresh下拉刷新组件中嵌套ViewPager的一个bug -
寐语者:
LeaderElection(String zookeeper ...
使用Zookeeper来为你的程序加上Leader Election的功能。 -
fyc0109:
博主, 安装了一部分还是报这个错误!FAILURE: Buil ...
gradlew wrapper使用下载到本地的gradle.zip文件安装。
https://github.com/ApmeM/android-flowlayout 使用这个类库。
import android.content.Context; import android.util.AttributeSet; import android.view.View; import android.view.ViewGroup; /** * * @author RAW */ public class FlowLayout extends ViewGroup { private final static int PAD_H = 2, PAD_V = 2; // Space between child views. private int mHeight; public FlowLayout(Context context) { super(context); } public FlowLayout(Context context, AttributeSet attrs) { super(context, attrs); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { assert (MeasureSpec.getMode(widthMeasureSpec) != MeasureSpec.UNSPECIFIED); final int width = MeasureSpec.getSize(widthMeasureSpec) - getPaddingLeft() - getPaddingRight(); int height = MeasureSpec.getSize(heightMeasureSpec) - getPaddingTop() - getPaddingBottom(); final int count = getChildCount(); int xpos = getPaddingLeft(); int ypos = getPaddingTop(); int childHeightMeasureSpec; if(MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST) childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(height, MeasureSpec.AT_MOST); else childHeightMeasureSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); mHeight = 0; for(int i = 0; i < count; i++) { final View child = getChildAt(i); if(child.getVisibility() != GONE) { child.measure(MeasureSpec.makeMeasureSpec(width, MeasureSpec.AT_MOST), childHeightMeasureSpec); final int childw = child.getMeasuredWidth(); mHeight = Math.max(mHeight, child.getMeasuredHeight() + PAD_V); if(xpos + childw > width) { xpos = getPaddingLeft(); ypos += mHeight; } xpos += childw + PAD_H; } } if(MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.UNSPECIFIED) { height = ypos + mHeight; } else if(MeasureSpec.getMode(heightMeasureSpec) == MeasureSpec.AT_MOST) { if(ypos + mHeight < height) { height = ypos + mHeight; } } height += 5; // Fudge to avoid clipping bottom of last row. setMeasuredDimension(width, height); } // end onMeasure() @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { final int width = r - l; int xpos = getPaddingLeft(); int ypos = getPaddingTop(); for(int i = 0; i < getChildCount(); i++) { final View child = getChildAt(i); if(child.getVisibility() != GONE) { final int childw = child.getMeasuredWidth(); final int childh = child.getMeasuredHeight(); if(xpos + childw > width) { xpos = getPaddingLeft(); ypos += mHeight; } child.layout(xpos, ypos, xpos + childw, ypos + childh); xpos += childw + PAD_H; } } } // end onLayout() }
发表评论
-
安卓各种长知识的技术文章,不断更新
2015-10-27 18:24 753http://blog.udinic.com/2015/09 ... -
发现一个android sdk更新神速的镜像
2015-09-02 11:26 887mirrors.dormforce.net:80 //(栋力无 ... -
gradle项目中怎么集中管理你的依赖库
2015-08-16 11:30 688项目结构 引用root --gradleScript ... -
使用Dexposed为你的安卓应用加上在线修复的能力。
2015-08-11 16:15 6093移动客户端应用相对于W ... -
解决android-Ultra-Pull-To-Refresh下拉刷新组件中嵌套ViewPager的一个bug
2015-08-02 00:15 17009在项目中使用了android-Ultra-Pull-To-Re ... -
android有质量的面试题
2015-03-17 14:31 883https://github.com/android-cn/i ... -
提高Android Studio的gradle编译速度。
2015-03-12 14:12 4371发现用Android Studio的make和直接使用comm ... -
gradlew wrapper使用下载到本地的gradle.zip文件安装。
2015-03-12 01:26 15366使用gradlew来build项目时,有时候老是需要下载gra ... -
gradlew wrapper设置代理下载gradle
2015-02-27 18:25 45061. HTTP Only Proxy configuratio ... -
认识mqtt
2015-01-30 11:43 1059http://www.hivemq.com/mqtt-esse ... -
Google的Android性能模式
2015-01-14 14:44 713http://www.infoq.com/cn/news/20 ... -
反对Fragment的理由,顺便叫你如果创建自己的自定义view
2014-12-18 17:08 1084下面这篇文章讲了反对Fragment的理由,顺便叫你如果创建自 ... -
获取status bar的高度
2014-12-16 19:52 1276public static int getStatus ... -
最新的appCompat support library中,actionbar的自定义view不能占用全部的宽度
2014-12-02 23:22 900<style name="AppTheme&q ... -
ScrollTricks实现StickHeader效果
2014-11-06 19:07 1082https://code.google.com/p/roman ... -
AppCompat v21 — Material Design for Pre-Lollipop Devices!
2014-10-23 11:03 844http://android-developers.blogs ... -
国内Android Sdk Manager不能更新的问题。
2014-09-15 15:49 921加hosts 引用203.208.46.146 dl.goo ... -
在Centos上安装android sdk遇到的问题。
2014-09-15 12:00 1354安装好android sdk后, 打包时老是会有下面的问题。 ... -
Android的一些制作图表按钮的工具
2014-09-09 16:36 1490Android Button Maker Android P ... -
DESIGNER'S GUIDE TO DPI
2014-08-29 14:37 442强烈建议美工看看, 对于移动app的多密度屏幕的支持 http ...
相关推荐
本文实例为大家分享了Android FlowLayout流式布局的具体代码,供大家参考,具体内容如下 最近使用APP的时候经常看到有 这种流式布局 ,今天我就跟大家一起来动手撸一个这种自定义控件. 首先说一下自定义控件的流程: ...
Android开源代码,自定义Layout,继承自LinearLayout,内部控件自动换行显示。例如:可用来开发数量变化的属性标签群。
android-flowlayout A very convenient and powerful flow layout created by Lan. minSdkVersion 11 Dependencies latest version see it as an icon in the beginning of the README file. gradle compile '...
安卓(android)选标签,很多都是做的FlowLayout瀑布流+ToggleButton的方式,因为它做tag比较符合现在的选择需要,不过支持左中右内容对齐外加滚动的可能没有实现,所以我给补齐,当然技术越来越新,可以考虑使用...
Android流式布局FlowLayout、使用简单、灵活修改(注意导入代码后需要关联V7包)
FlowLayout is an opensource Android library that alows developers to easily integrate flow layout into their app. FlowLayout is an layout that display its children in multiple rows depending on their ...
Android Material FlowLayout简单使用
Android实现FlowLayout流式布局(仿热门标签)
android 自定义view流式布局,
Android 流式布局FlowLayout 实现关键字标签
Textview默认展示固定行数,展示不全使用省略号代替;点击更多时,加载全部文本内容。
public class FlowLayout extends ViewGroup { protected DataSetObserver mDataSetObserver; private FlowBaseAdapter mAdapter; /** * 所有的子view按行存储 */ private final List<List> mAllChildViews; ...
Android_实例_利用RadioButton实现分类筛选
主要为大家详细介绍了Android流式布局FlowLayout的相关资料,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
[快速理解android View的测量onMeasure()与MeasureSpec](http://blog.csdn.net/double2hao/article/details/51553703) ###2、Layoutparams以及MarginLayoutParams [Android开发:LayoutParams的用法]...
流式布局,自动计算高度,自动换行,具体效果(可以参考微信收藏的标签编辑页)