一屏中的三个列表视图

发布于 2024-12-09 15:33:41 字数 379 浏览 0 评论 0原文

我在 iPhone 上有一个应用程序,采用如图所示的层叠设计,我想将其移植到 Android 上。有没有简单且推荐的方法来做到这一点?

左侧的部分菜单(A、B、C、D 部分)是用户需要首先选择的,然后用户需要选择中间的类别(全部、流行、pc、xbox,...) ,然后他会看到所选类别的文章列表。

我可以想象使用三个 ListView 来完成此操作,但应用程序还可以监听滑动手势以使最右边的 ListView “全屏”,并隐藏前两个列表视图。我可以为整个活动实现一个滑动侦听器,并将前两个列表视图的可见性设置为隐藏,对吗?

我的假设正确吗?这是正确的方法吗?

在此处输入图像描述

I have an app on iPhone with cascading design like on the picture, and I'd like to port it to Android. Is there a simple and recommended way to do this?

The section menu on the left (Section A, B,C,D) is the first that the user needs to select, then the user needs to pick a category in the middle (all, popular, pc, xbox,...), then he is presented with a list of articles for chosen category.

I could imagine doing it with three ListViews, but then the app could also listen to a swipe gesture to make the rightmost ListView "full screen", and hide the first two listviews. I could implement a swipe listener for the whole activity and set first two listviews' visibility to hidden, right?

Are my assumptions correct and would this be the right way to do this?

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ぃ双果 2024-12-16 15:33:41

它绝对可以按照你解释的方式工作——如果设计好那就是另一个讨论了。 ,当空间像大多数手机一样有限时,我不喜欢在一个屏幕上投入无穷无尽的数据(我可能会使用 3 个不同的屏幕,每个屏幕上都有一个 ListView)

就我个人而言 滑动手势是可行的,您当然可以使用函数 setVisibility( View.GONE ) 隐藏其他两个 ListView。

希望有帮助。

It could definetly work the way you explain it - if the design is good is another discussion. Personally I'm not a fan of throwing in endless amounts of data in one screen, when the space is as limited as it is on most mobile phones (I would probably do it with 3 different screens with a ListView on each)

Implementing the mentioned swipe gesture is doable and you could certainly just hide the two other ListViews with the function setVisibility( View.GONE ).

Hope it helps.

段念尘 2024-12-16 15:33:41
  1. 您可能想使用新的fragments API,它是专门为此类事情构建的(并且一直兼容到Android 1.6)。此外,正如 KasperMoerch 所说,将所有信息放在小屏幕上可能会变得很难看。使用片段将使您更容易随着屏幕尺寸的增加而逐渐增加显示的信息量。
  2. 我不确定您是否可以在整个活动中监听滑动手势。我认为您必须将片段包装在自定义视图中(例如扩展的 LinearLayout )并在那里进行滑动监听。然而,实现手指跟踪动画(即最右边的窗格在手指扫过时精确地跟随手指)是一项相当艰巨的任务(我真的不知道从哪里开始,尽管可能是在自定义视图中)。 (我认为)最好的方法是做出妥协,当您检测到滑动时启动动画(从右到左滑动)。然而,最简单的解决方案是根本不设置动画。
  3. 您还可以考虑完全放弃滑动手势,只提供“展开”按钮。
  1. You might want to use the new fragments API, it's specifically built for this kind of thing (and it's compatible all the way down to Android 1.6). Also, as KasperMoerch says, putting all that info on a small screen can get ugly. Using fragments will make it easier for you to gradually increase the amount of information displayed as the screen size increases.
  2. I'm not sure you can just listen for a swipe gesture over an entire activity like that. I think you have to wrap the fragments in a custom view (for example an extended LinearLayout) and do the swipe listening there. However, achieving a finger-tracking animation (i.e. where the rightmost pane follows the finger precisely as it swipes across) is a pretty daunting task (I wouldn't really know where to begin, probably in the custom view though). The best way (I think) to do it is to make a compromise and just start an animation (right-to-left slide) when you detect a swipe. However, the simplest solution is to not animate at all.
  3. You can also take into consideration dropping the swipe gesture altogether and just providing an "expand" button.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文