GridView控件与可变宽度的物品 [英] GridView with variable width items

查看:328
本文介绍了GridView控件与可变宽度的物品的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要实现像 last.fm标签云行为

这意味着:我的项目有的android:layout_width =WRAP_CONTENT,我需要水平显示,直到项目不会对<$ C $适合水平C>查看,这将是下一行的第一个项目。我还想来填充视图的 ListAdapter

This means: my items have android:layout_width="wrap_content", and I need to display horizontally until an item doesn't fit horizontally on the View, which will be the first item of the next row. I'd also like to populate the view with a ListAdapter.

编写这样的观点似乎过于复杂。是否有达到这种效果的库项目?

Writing such View seems overly complicated. Is there any library project that achieves this effect?

推荐答案

什么你要找的是一个的FlowLayout 。它不会在原生Android的存在,但罗曼盖伊(前的Andr​​oid工程师)给谈话呈现出快速实施,并且也有几个可用的库,你可以使用,否则易发生侧滑你自己的。

What you're looking for is a FlowLayout. It doesn't exist natively in Android, but Romain Guy (a former Android engineer) gave a talk showing a quick implementation, and there are also several libraries available that you could use, or easily spin your own.

https://github.com/ApmeM/android-flowlayout 结果
https://github.com/blazsolar/FlowLayout 结果
HTTP://nishantvnair.word$p$pss。 COM / 2010/09/28 / FlowLayout中,在安卓/ 结果
http://hzqtc.github.io/2013/12/android -custom,布局flowlayout.html

这篇关于GridView控件与可变宽度的物品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆