jack921
V2EX  ›  Android

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

By jack921 at 2016 年 1 月 18 日 · 14264 次点击
3 条回复  •  2016-01-18 09:31:32 +08:00
kassadin
   1
kassadin  
   2016 年 1 月 18 日   ❤️ 1
youku,手机,竖屏

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

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

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

3.最后的『推荐』 RecyclerView
nicegoing
   2
nicegoing  
   2016 年 1 月 18 日   ❤️ 1
@kassadin 中间的各频道应该是自定义的 ViewGroup 吧,类似微博或微信那种。 viewStub 只能 inflate 一次,没法重用啊。
kassadin
   3
kassadin  
   2016 年 1 月 18 日
@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>
© 2026 V2EX · 28ms · 3.9.8.5