android metro 源码,android_tv_metro

本文详细介绍了TV Metro风格的UI构建,包括Album和DisplayItem两种核心元素,用于展示视频、游戏、应用等内容。Album可以包含多个Album和DisplayItem,DisplayItem则定义为视频、游戏等。主要页面也是一个Album,同时提供了Tab app/game、video和videocategory的定义。JSON数据结构展示了Home显示数据的布局和详细DisplayItem的信息。此外,还提到了Android库的使用和API数据结构,帮助开发者构建TV Metro UI风格的应用。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

TV Metro android lib and API

hailongqiu 修改[源码分析----源码分析.ynt]

#API & Data structure

the Metro style is constructed by two kinds of elements:

Album and Display Item

Album can contain multi albums and display items.

Display item can be defined as video, game, app, music and so on.

You can deprive your own game/app/video detail item from display item.

Album

|

__________________|___________________

| ... | | ... |

Album Album Display Item Display Item

The main page is also defined as Album.

ns : namespace, resource type

type: item or item list

id : resource id in back-end server system

Note:

Album and Category are most same concept.

##Tab "app/game"

1d10620c4bfb357f7eb81ce0bebbbfbf.png

##Tab "video"

37f9bc823ce7bae359d17461c4926c5b.png

##Tab "video category"

a32d4a8d543a7facfbf134141df882ec.png

##Home JSON definition

##Home display data

{

"data": [

{

"items": [display items],

"images": {},

"name": "TAB 1",

"id": "recommend",

"type": "album",

"ns": "video"

},

{

"items": [display item],

"images": {},

"name": "TAB 2",

"id": "recommend",

"type": "album",

"ns": "video"

}

]

}

##Display Item:

{

"target": {

"type": "item"

},

"images": {

"back": {

"url": "",

"ani": {},

"pos": {}

}

},

"name": "Display Name)",

"times": {

"updated": 1409202939,

"created": 1409202939

},

"_ui": {

"layout": {

"y": 2,

"x": 3,

"w": 1,

"h": 1

},

"type": "metro_cell_banner"

},

"id": "987722",

"type": "item",

"ns": "video"

}

##Album

{

"data": [

{

"items": [display items],

"images": { },

"name":"game tab name",

"times": {

"updated": 0,

"created": 0

},

"_ui": {

"type": "metro"

},

"id": "recommend",

"type": "album",

"ns": "game"

},

{

"items": [display items],

"images": { },

"name": "game tab Name",

"times": {

"updated": 0,

"created": 0

},

"_ui": {

"type": "metro"

},

"id": "categories",

"type": "album",

"ns": "game"

},

{

"items": [dispay items],

"images": { },

"name": "video tab name",

"times": {

"updated": 0,

"created": 0

},

"_ui": {

"type": "metro"

},

"id": "recommend",

"type": "album",

"ns": "video"

},

{

"items": [display items],

"images": { },

"name": "video tab name",

"times": {

"updated": 0,

"created": 0

},

"_ui": {

"type": "metro"

},

"id": "categories",

"type": "album",

"ns": "video"

}

],

"preload": {

"images": []

},

"update_time": 0

}

##Display Item

{

"target": {

"type": "item"

},

"images": {

"text": {

"url": "",

"ani": {},

"pos": {}

},

"icon": {

"url": "",

"ani": {},

"pos": {}

},

"back": {

"url": "http://xxx/fffff.png",

"ani": {},

"pos": {}

},

"spirit": {

"url": "",

"ani": {},

"pos": {}

}

},

"name": "name",

"times": {

"updated": 1404466152,

"created": 1404454443

},

"_ui": {

"type": "metro_cell_banner",

"layout": {

"y": 1,

"x": 1,

"w": 1,

"h": 2

}

},

"id": "180",

"type": "item",

"ns": "game"

}

##TV Metro liberary and API

###android lib:

supply one framework to build sw540dp metro layout.

###API:

server API and data structure.

This framework help you easy to build one TV metro UI style applicaiton. As for detail business data definition, you need handle by your selft.

##android Lib

RecommendCardView Card view

GenericSubjectLoader Loader for album(tabs is one instance of album)

##How to integrate the android lib?

you just need inherit MainActity and implement your Tabs Loader.

Refer to TVMetroSample application

How to implement your owver server?

step one:

1, define your home data

2, implement your details/list API

##Download test APK

Download test apk, you can run it at android pad or TV

Click Download

##Welcome to Contact US

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值