【问题标题】:Display different ui on TV screen when connect with screen casting with android app in android studio?与android studio中的android应用程序连接屏幕投射时,在电视屏幕上显示不同的ui?
【发布时间】:2022-06-13 00:56:16
【问题描述】:

当应用在 android studio 中通过电视投射屏幕时,我想显示不同的 UI。

我尝试了很多,但还没有成功。请帮我解决这个问题。

【问题讨论】:

    标签: java android android-studio android-layout android-developer-api


    【解决方案1】:

    有点晚了,但我很乐意为您提供帮助。

    1. 首先您必须在布局目录中创建一个新文件,例如“custom_cast_ui.xml”。

    2. 在您的活动中,您需要像这样调用“custom_cast_ui.xml” -> setContentView(R.layout.custom_cast_ui);

    3. 如果需要调用ImageView之类的元素,可以照常进行,因为新的布局已经设置好了。像这样 -> ImageView imageView = findViewById(R.id.img_example);

    希望对你有帮助:D

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多