安卓TvView显示hdmi-in画面

1.布局

复制代码
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <android.media.tv.TvView
        android:id="@+id/tv_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"  />

</RelativeLayout>

2.主界面代码

复制代码
TvInputManager  tvInputManager = (TvInputManager) getSystemService(TV_INPUT_SERVICE);
List<TvInputInfo> list = tvInputManager.getTvInputList();
TvView mTvView = findViewById(R.id.tv_view);
mTvView.reset();
Uri uri = buildChannelUriForPassthroughInput(list.get(0).getId());
new Handler().postDelayed(() -> mTvView.tune(list.get(0).getId(),uri),1000);

功能其实很简单, mTvView.tune(list.get(0).getId(),uri) 这一句需要延迟一点,可能跟加载uri速度有关系,不延迟的话显示不了.

相关推荐
冬奇Lab1 天前
相机拍照流程:从快门按下到JPEG存储的完整旅程
android·音视频开发·源码阅读
alexhilton1 天前
在Compose中用Shader实现透明的粘稠元球效果
android·kotlin·android jetpack
jwn9991 天前
Laravel5.x核心特性全解析
android·php·laravel
studyForMokey1 天前
【Android面试】RecylerView专题
android·spring·面试
android_cai_niao2 天前
Android中有什么技术过时了可以直接用新技术的
android·过时技术
lingggggaaaa2 天前
PHP原生开发篇&文件安全&上传监控&功能定位&关键搜索&1day挖掘
android·学习·安全·web安全·php
我是场2 天前
我的NPI项目 - OTA upgrade是什么?
android·人工智能
zh_xuan2 天前
Android 实现fragment导航
android·fragment导航
java资料站2 天前
MySQL 增量同步脚本
android·数据库·mysql
穷人小水滴2 天前
手机安装 Cross Profile Test App (Android)
android·手机·一加