【问题标题】:GridView with varying cell sizes, Launcher WP8 style [duplicate]具有不同单元格大小的 GridView,Launcher WP8 样式 [重复]
【发布时间】:2015-06-12 13:22:06
【问题描述】:

问题

我想要一个特殊的 UI,它类似于 Windows 8 Tiles UI,具有不同大小的单元格。

类似这样的:

AABB
AACC
AADD
AADD

每个字母代表其单元格的一部分,因此单元格 A 为 2x4 ,单元格 B 和单元格 C 各取 2x1 ,单元格 D 为 2x2。

Laucher 8 就是一个很好的例子。

我不想使用网格布局。

我正在使用 GridView,但无法使用 GridView 实现上述布局。

问题

1. I have a framelayout as the items in the adapter.
   Using Linear Layout instead of adapter supporting view will certainly 
   make it boring
   or
   May be I am wrong about Linear Layout.
2. Can such a layout be achieved through GridView.
3. How [Laucher 8][2]. is achieving that.

编辑

My problem was solved using https://github.com/lucasr/twoway-view/ . Google's
staggeredViewGridLayoutManager didn't help may be because I didn't found
it's good usage documentation and I was not able to layout the items in the 
Layout in my desired location.

【问题讨论】:

  • “我不想使用网格布局”——为什么?如果你解释为什么一个明显的选择是你不想要的东西,它将帮助其他人给你更好的建议。 “这样的布局能不能通过GridView来实现。” - 不。 GridView 单元格大小一致。 “[Laucher 8][1] 是如何实现这一目标的”——使用 uiautomatorviewer 并找出答案。除此之外,您所指的通常称为“交错网格”,可以使用RecyclerView 和各种开源库创建一个。
  • 谢谢@CommonWare。 GridLayout 是非常新的布局,恐怕它不会在旧的 android 版本中运行。不知道 uianimatorViewer。
  • “GridLayout 是一个非常新的布局”——它已经存在了四年。 “恐怕它不会在旧的 android 版本中运行”——Android 支持包中提供的gridlayout-v7 反向移植可以追溯到 API 级别 7,它涵盖了 99+% 的活动 Android 设备。
  • @CommansWare,在互联网的某个地方,我错误地读到 Gridlayout 支持 API 17。我的错。如果我使用 GridLayout,我将不得不定义每个图块的每个位置和大小。此外,我正在使用大约 100 多个瓷砖。此外,我的移动 API 级别低于 16,因此无法使用 uiautomatorviewer。但我明白了。
  • @dberm22 不,它不重复。我不希望我的布局是 pinterest 风格的。

标签: android android-layout android-linearlayout android-gridview android-launcher


【解决方案1】:

尝试查看StaggeredGridView。这不是您想要的,但您可以根据需要对其进行修改。

也有可能,这是pinterest-styleGridView

您可能还想联系this app 的开发人员。他可能会给你一些答案。

【讨论】:

    猜你喜欢
    • 2013-09-04
    • 2017-10-26
    • 1970-01-01
    • 2011-05-12
    • 1970-01-01
    • 1970-01-01
    • 2020-11-28
    • 2011-10-02
    相关资源
    最近更新 更多