首页 > 解决方案 > 如何将参数传递给kotlin中videoview xml的setvideopath方法

问题描述

我有一个简单的问题,是否可以从 kotlin 中的 xml 文件调用 setvideoPath 方法

这是我的视频视图标签

        <VideoView
        android:id="@+id/url"
        android:layout_width="0dp"
        android:layout_height="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent" />

我应该添加什么来将参数传递给 setVideoPath 方法

注意我不想使用

findViewById 

方法,因为我使用的是 MVVM 模式

标签: androidkotlinandroid-videoview

解决方案


推荐阅读