android table with more than one column like iOS c

2019-04-07 20:51发布

is there a custom UI element on android that will behave like iOS collection view? [like a grid view, that is scrollable] or do I have to make a custom table layout custom cells that behave like columns?

here a shot of a UICollectionView for iOS uiCollection View

is there an example for this?

thanks!

4条回答
forever°为你锁心
2楼-- · 2019-04-07 21:35

This is old, but the Google team have created a widget used in the IO 2014 app that's perfect. It allows for variable column rows and even headers out of the box.

https://github.com/google/iosched/blob/master/android/src/main/java/com/google/samples/apps/iosched/ui/widget/CollectionView.java

You'd have to dig through the source for how it's used, but it's really easy and great to use.

查看更多
成全新的幸福
3楼-- · 2019-04-07 21:37

Since the previous answer does not reflect performance issues, such as it does not use recycling (which is important for long lists), here is what you are probably looking for:

GridView if your building blocks are all equal in size http://developer.android.com/guide/topics/ui/layout/gridview.html

or ListView (and a lot of custom logic) if your building blocks have different sizes/widths http://developer.android.com/guide/topics/ui/layout/listview.html

查看更多
一纸荒年 Trace。
4楼-- · 2019-04-07 21:47

I don't know the collection view in iOS, but I guess TableLayout is what you are looking for.

https://developer.android.com/reference/android/widget/TableLayout.html

In API14+ there is GridLayout as well.

https://developer.android.com/reference/android/widget/GridLayout.html

查看更多
Anthone
5楼-- · 2019-04-07 21:52

Gridview is best replacement of Collection View of IOS. following URL will solve your problem.

http://developer.android.com/guide/topics/ui/layout/gridview.html

查看更多
登录 后发表回答