VideoView to match parent height and keep aspect ratio

前端 未结 12 1931
轻奢々
轻奢々 2020-11-28 08:15

I have a VideoView which is set up like this:



        
12条回答
  •  无人及你
    2020-11-28 08:52

    Jobbert's answer in Kotlin, in case anyone needs it:

    val max = if (videoView.height > videoView.width) videoView.height else videoView.width
    videoView.layoutParams = ConstraintLayout.LayoutParams(max, max)
    

提交回复
热议问题