智能电视(电视盒子)开发基础教程(附sdk)

 为了解决 各种盒子兼容问题,各种屏幕的分辨率问题,楼主推荐一个 电视开发的sdk ,非常好用


下载

命令行: git clone https://github.com/boxmate/tvframe.git  

或者  

打开https://github.com/boxmate/tvframe,右下角 Download Zip



下载文件中有两个目录

    
 
 
frametv/ 为框架工程源码 framedemo/ 为DEMO示例工程.
导入: 一、下载完成后,同平常方式导入两个项目,即:File -> Import -> Android -> Existing Projects Into Workspace; 得到两个工程
RecoTvFrame 框架 RecoTvFrameDemo demo
二、将RecoTvFrame添加为Library
1.选中RecoTvFrame框架工程 右键,点击最下方的Properties 2.点击左侧的Android选项,勾选右下方的 Is Library 3.点确认
三、引入RecoTvFrame
我们以demo工程为例 1.在demo工程上右键,点击最下方的Properties 2.点击左侧的Android选项,点击右方的 Add 3.选中RecoTvFrame 添加,完成导入操作
四、处理android-support-v4.jar冲突
1.请先移除你自己的项目中的V4包(libs/ 目录中),然后复制框架 libs/ 目录中V4包到你自己的工程对应目录中, 2.选中V4包右键Build Path -> Add To Build Path
五、运行Demo工程(或者你自己的工程)


楼主用这个sdk 开发了一个 helloword


非常简单

代码如下

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools/"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context=".MainActivity" >

    <reco.frame.tv.view.TvButton 
        android:layout_width="@dimen/px100"
        android:layout_height="@dimen/px100"
        android:layout_marginLeft="@dimen/px100"
        android:layout_marginTop="@dimen/px200"
        android:background="#ff0000"
        android:text="H"
        />
    <reco.frame.tv.view.TvButton 
        android:layout_width="@dimen/px100"
        android:layout_height="@dimen/px100"
        android:layout_marginLeft="@dimen/px210"
        android:layout_marginTop="@dimen/px200"
        android:background="#ff0000"
        android:text="E"
        />
    <reco.frame.tv.view.TvButton 
        android:layout_width="@dimen/px100"
        android:layout_height="@dimen/px100"
        android:layout_marginLeft="@dimen/px320"
        android:layout_marginTop="@dimen/px200"
        android:background="#ff0000"
        android:text="L"
        />
    <reco.frame.tv.view.TvButton 
        android:layout_width="@dimen/px100"
        android:layout_height="@dimen/px100"
        android:layout_marginLeft="@dimen/px430"
        android:layout_marginTop="@dimen/px200"
        android:background="#ff0000"
        android:text="L"
        />
	<reco.frame.tv.view.TvButton 
        android:layout_width="@dimen/px100"
        android:layout_height="@dimen/px100"
        android:layout_marginLeft="@dimen/px540"
        android:layout_marginTop="@dimen/px200"
        android:background="#ff0000"
        android:text="O"
        />
	
	
	
	
	<reco.frame.tv.view.TvButton 
        android:layout_width="@dimen/px100"
        android:layout_height="@dimen/px100"
        android:layout_marginLeft="@dimen/px100"
        android:layout_marginTop="@dimen/px400"
        android:background="#00ff00"
        android:text="W"
        />
    <reco.frame.tv.view.TvButton 
        android:layout_width="@dimen/px100"
        android:layout_height="@dimen/px100"
        android:layout_marginLeft="@dimen/px210"
        android:layout_marginTop="@dimen/px400"
        android:background="#00ff00"
        android:text="O"
        />
    <reco.frame.tv.view.TvButton 
        android:layout_width="@dimen/px100"
        android:layout_height="@dimen/px100"
        android:layout_marginLeft="@dimen/px320"
        android:layout_marginTop="@dimen/px400"
        android:background="#00ff00"
        android:text="R"
        />
    <reco.frame.tv.view.TvButton 
        android:layout_width="@dimen/px100"
        android:layout_height="@dimen/px100"
        android:layout_marginLeft="@dimen/px430"
        android:layout_marginTop="@dimen/px400"
        android:background="#00ff00"
        android:text="L"
        />
	<reco.frame.tv.view.TvButton 
        android:layout_width="@dimen/px100"
        android:layout_height="@dimen/px100"
        android:layout_marginLeft="@dimen/px540"
        android:layout_marginTop="@dimen/px400"
        android:background="#00ff00"
        android:text="D"
        />
	
	
	
	
    
</RelativeLayout>


就是简单的一个activity ,然后用sdk中的  tvbutton控件


然后是个焦点放大效果,


sdk的demo中有很多的 案例,大家可以下来一个一个研究一下,基本上开发一个电视应用就没什么大问题了


 框架官方主页:点击打开链接

  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值