安卓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速度有关系,不延迟的话显示不了.

相关推荐
gregmankiw4 小时前
Nemotron架构(Mamba3+Transformer+Moe)
android·深度学习·transformer
xianjian09126 小时前
MySQL 的 INSERT(插入数据)详解
android·数据库·mysql
欧简墨7 小时前
kotlin Android Extensions插件迁移到viewbinding总结
android·trae
货拉拉技术7 小时前
优雅解决Android app后台悬浮窗权限问题
android
用户69371750013848 小时前
Android 手机终于能当电脑用了
android·前端
用户5172231574808 小时前
android资源类型与布局资源详细介绍
android
优选资源分享9 小时前
GKD v1.11.6 | 安卓开屏广告跳过工具 可用版
android
robotx9 小时前
安卓zygote启动相关
android
Mac的实验室10 小时前
2026年最新真实社交怎么注册?手把手教你如何成功注册Truth Social账号
android
毕设源码-郭学长11 小时前
【开题答辩全过程】以 基于Android的点餐APP的设计为例,包含答辩的问题和答案
android