请问 android 像优酷首页,芒果 TV 首页界面是怎么实现的,是 ListView 嵌套 GridView

2016-01-18 01:48:47 +08:00
 jack921
6472 次点击
所在节点    Android
3 条回复
kassadin
2016-01-18 03:17:27 +08:00
youku,手机,竖屏

整体 swipe + RecyclerView,内部主要 3 种布局

1. 首页直接看到的部分
Gallary + Recycler(10 个 item) + LinearyLayout(4 视频)

2. 中间各个频道
有明显分割线,不是 AdapterView ,是 LinearLayout+ViewStub 写死的最多 4 行 8 视频

3.最后的『推荐』 RecyclerView
nicegoing
2016-01-18 03:55:52 +08:00
@kassadin 中间的各频道应该是自定义的 ViewGroup 吧,类似微博或微信那种。 viewStub 只能 inflate 一次,没法重用啊。
kassadin
2016-01-18 09:31:32 +08:00
@nicegoing 不是,你用 ddms 看下就知道了

<?xml version="1.0"?>
<LinearLayout android:orientation="vertical" android:background="@color/white" android:layout_width="fill_parent" android:layout_height="wrap_content" xmlns:android="http://schemas.android.com/apk/res/android">
<com.youku.phone.home.view.HomeCardTitleView android:id="@id/home_card_title_view" android:layout_width="fill_parent" android:layout_height="wrap_content" />
<ViewStub android:id="@id/home_video_land_item_wide" android:layout="@layout/home_card_item_cross" android:layout_width="fill_parent" android:layout_height="wrap_content" />
<ViewStub android:id="@id/home_video_land_item_column1" android:layout="@layout/home_card_item_column" android:layout_width="fill_parent" android:layout_height="wrap_content" />
<ViewStub android:id="@id/home_video_land_item_column2" android:layout="@layout/home_card_item_column" android:layout_width="fill_parent" android:layout_height="wrap_content" />
<ViewStub android:id="@id/home_video_land_item_column3" android:layout="@layout/home_card_item_column" android:layout_width="fill_parent" android:layout_height="wrap_content" />
<ViewStub android:id="@id/home_video_land_item_column4" android:layout="@layout/home_card_item_column" android:layout_width="fill_parent" android:layout_height="wrap_content" />
<ViewStub android:id="@id/home_video_land_item_extend" android:layout_width="fill_parent" android:layout_height="wrap_content" />
<ViewStub android:id="@id/home_video_land_item_tailer" android:layout="@layout/home_card_item_tail_layout" android:layout_width="fill_parent" android:layout_height="wrap_content" />
</LinearLayout>

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/251469

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX