1、开发Android TV APP, 使用遥控器选中按钮或者选着其它菜单

如果没有高亮显示,就看不出选中哪个按钮或者菜单

2、在drawable 添加 border_red.xml 设置选中高亮

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="2dp"/>
<stroke
android:color="#FF0000"
android:width="3dp" />
<solid android:color="#00FF0000" />
</shape>

3、在 layout 添加页面xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RelativeLayout
android:focusable="false"
android:gravity="center"
android:layout_gravity="center"
android:clipToPadding="false"
android:clipChildren="false"
android:id="@+id/main"
android:layout_width="match_parent"
android:layout_height="wrap_content"> <Button
android:id="@+id/button_id_1"
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="wrap_content"
android:background="#303F9F"
android:focusableInTouchMode="true"
android:textColor="#FFF"
android:layout_marginTop="10dp"
android:layout_marginLeft="0dp"
android:text="按钮"
android:textSize="60dp"
/> <Button
android:id="@+id/button_id_2"
android:layout_below="@id/button_id_1"
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="wrap_content"
android:background="#303F9F"
android:focusableInTouchMode="true"
android:textColor="#FFF"
android:text="按钮"
android:layout_marginTop="30dp"
android:textSize="60dp"
/> <Button
android:id="@+id/button_id_3"
android:layout_width="match_parent"
android:gravity="center"
android:layout_height="wrap_content"
android:background="#303F9F"
android:layout_below="@id/button_id_2"
android:focusableInTouchMode="true"
android:textColor="#FFF"
android:text="按钮"
android:layout_marginTop="30dp"
android:textSize="60dp"
/> </RelativeLayout>
</LinearLayout>

4、添加选中高亮显示,设置焦点控制

  BorderView border = new BorderView(this);
border.setBackgroundResource(R.drawable.border_red); main = (RelativeLayout) findViewById(R.id.main);
border.attachTo(main);

Android TV 选中高亮显示的更多相关文章

  1. android TV选中时高亮凸显效果

    链接: http://pan.baidu.com/s/1pLjAFQ7 密码: xb8g <ignore_js_op> 360手机助手截图0410_18_02_01.png (335.64 ...

  2. Android TV上的焦点切换效果

    转载:http://blog.csdn.net/wzlas111/article/details/39741091 Android TV上的焦点凸显特效相信大家都看到过,那么我们就来实现它吧,首先上张 ...

  3. 联发科发布全球首款搭载Android TV的智能电视系统芯片MT5595

    联发科发布全球首款搭载Android TV的智能电视系统芯片MT5595 admin 资讯 01-07 1 1月7日消息,联发科宣布与Google共同开发出全世界第一个搭载Android TV操作系统 ...

  4. Android Tv 中的按键事件 KeyEvent 分发处理流程

    这次打算来梳理一下 Android Tv 中的按键点击事件 KeyEvent 的分发处理流程.一谈到点击事件机制,网上资料已经非常齐全了,像什么分发.拦截.处理三大流程啊:或者 dispatchTou ...

  5. Android TV 电视调试和遥控器事件监听

    Android TV 真机调试 要进行Android TV开发免不了要进行真机调试. 1.确定电视盒子和开发机器在同一局域网中 2.打开电视盒子的adb允许调试开关 3.进入adb所在文件夹进行adb ...

  6. Android TV开发总结(六)构建一个TV app的直播节目实例

    请尊重分享成果,转载请注明出处:http://blog.csdn.net/hejjunlin/article/details/52966319 近年来,Android TV的迅速发展,传统的有线电视受 ...

  7. Android TV开发总结(五)TV上屏幕适配总结

    前言:前面几篇总结一些TV上的小Sample,开源到GitHub:https://github.com/hejunlin2013/TVSample, 点击链接,可以持续关注.今天总结下TV上屏幕适配. ...

  8. Android TV开发总结(三)构建一个TV app的焦点控制及遇到的坑

    转载请把头部出处链接和尾部二维码一起转载,本文出自逆流的鱼yuiop:http://blog.csdn.net/hejjunlin/article/details/52835829 前言:上篇中,&l ...

  9. Android TV开发总结(二)构建一个TV Metro界面(仿泰捷视频TV版)

    前言:上篇是介绍构建TV app前要知道的一些事儿,开发Android TV和手机本质上没有太大的区别,屏大,焦点处理,按键处理,是有别于有手机和Pad的实质区别.今天来介绍TV中Metro UI风格 ...

随机推荐

  1. 准备MPI编程环境——Visual Studio

    准备 下载并安装Visual Studio 2017 下载并安装MPI  (建议使用MSMPI,相对简单方便一点,可以从微软官网下载获得) 配置 新建空白项目 在该项目中新建源文件 右击项目-> ...

  2. char如何储存3个字节或者4个字节

    1.char字符存储的是Unicode编码的代码点,也就是存储的是U+FF00这样的数值,然而我们在调试或者输出到输出流的时候,是JVM或者开发工具按照代码点对应的编码字符输出的. 2. 所以虽然UT ...

  3. NOIP2018 滚粗记

    Day -2  上午,大家都在复习各种模板,zhx总结了足足67个模板(杨辉三角也算模板???),lgl死磕FFT发现cos和sin打反了,我也是复习板子和以前做过的题,几乎没有人颓. 接着jdr,l ...

  4. java web 基本属性

    page指令 属性 描述 默认值 language 指定JSP页面使用的脚本语言 java import contenType include指令 taglib注释 <!--我是html注释-- ...

  5. PAT 1101 Quick Sort

    There is a classical process named partition in the famous quick sort algorithm. In this process we ...

  6. 火柴棒等式(2008年NOIP全国联赛提高组)

    题目描述 Description 给你n根火柴棍,你可以拼出多少个形如“A+B=C”的等式?等式中的A.B.C是用火柴棍拼出的整数(若该数非零,则最高位不能是0).用火柴棍拼数字0-9的拼法如图所示: ...

  7. asp.net--mvc--异步编程

    Using Asynchronous Methods in ASP.NET MVC 4 asp.net mvc中的异步只能增加系统的性能,原来需要500个线程的,现在需要50个就够了,对一些常规的程序 ...

  8. CODEVS——T 2969 角谷猜想

    http://codevs.cn/problem/2969/  时间限制: 1 s  空间限制: 32000 KB  题目等级 : 黄金 Gold 题解  查看运行结果     题目描述 Descri ...

  9. PHP array_chunk()

    定义和用法 array_chunk() 函数把一个数组分割为新的数组块. 其中每个数组的长度由参数 size 决定. 可选参数 preserve_key 是一个布尔值,它指定新数组是否使用原数组相同的 ...

  10. springmvc mybatis 分页插件 pagehelper

    springmvc mybatis 分页插件 pagehelper 下载地址:pagehelper 4.2.1 , jsqlparser 0.9.5 https://github.com/pagehe ...