可以通過VideoView放置任何視圖? (即將控制按鈕放在視頻上,就像vimeo一樣)。我正在嘗試使用FrameLayout來完成,但我還沒有找到方法,而且我仍然不確定是否我想要做的事情根本不可能。通過VideoView在Android上放置任何視圖
9
A
回答
2
它應該工作得很好,但我會使用RelativeLayout
。您可以看到類似的一組佈局here,儘管SurfaceView
使用MediaPlayer
而不是VideoView
進行視頻播放。不過,應該沒有區別。
6
我用FrameLayout來做這種事情。您需要做的是確保控件位於佈局編輯器中的VideoView下方。
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:background="@color/MenuTextNormal">
<VideoView
android:id="@+id/VideoView"
android:layout_height="fill_parent"
android:layout_width="fill_parent" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/ControlLayout"
android:layout_gravity="bottom|center_horizontal">
<Button
android:text="@+id/Button01"
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:text="@+id/Button02"
android:id="@+id/Button02"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:text="@+id/Button03"
android:id="@+id/Button03"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<Button
android:text="@+id/Button04"
android:id="@+id/Button04"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
</FrameLayout>
相關問題
- 1. 在Android上播放RTMP視頻流videoview
- 2. 在VideoView中放置視頻
- 3. Android:在任意位置放置視圖
- 4. 無法通過VideoView API播放視頻
- 5. Android VideoView未播放視頻
- 6. 如何在videoview上播放.mp4視頻
- 7. 如何在VideoView上播放Youtube視頻?
- 8. 我無法在Android上設置多個視圖RSTP videoview
- 9. 如何使用VideoView/MediaPlayer在Android上播放流媒體視頻
- 10. 在Android上播放視頻之前下載視頻VideoView
- 11. 在Android中使用VideoView播放視頻
- 12. 在VideoView中播放視頻android
- 13. 在VideoView Android中播放youtube視頻
- 14. 如何在屏幕上的任何位置放置視圖?
- 15. 如何在屏幕上的任何位置放置子視圖,'停靠視圖'
- 16. 在Android應用程序中通過VideoView將播放視頻靜音
- 17. 通過拖放複製視圖Android
- 18. 在Android上播放視頻的VideoView /佈局
- 19. Android VideoView無法播放視頻
- 20. Android VideoView不播放連續視頻
- 21. Android VideoView無法播放視頻mp4
- 22. Android視頻播放,但VideoView不出現
- 23. Android:視頻不能播放Videoview
- 24. Android - VideoView無法播放此視頻
- 25. Android VideoView同時播放2個視頻
- 26. Android相機在相機視圖上的任何位置自定義縮放
- 27. Android - 如何使用uri源碼在VideoView上設置縮略圖?
- 28. 通過拖放操作Android卡片視圖更改位置
- 29. 如何在VideoView的幫助下播放視頻在android
- 30. 如何通過onclick將圖像放置在android中的另一個圖像上?
如果我用'setZOrderOnTop(真)'用於'VideoView',因爲它是根據[這萬阿英,蔣達清]的溶液(http://stackoverflow.com/questions/19650483/video-is-not -showing-on-videoview-but-i-can-hear-its-sound),那我怎麼能把它放在它上面呢? – Eido95 2016-10-31 21:48:19
這是正確的,'setZOrderOnTop'將使VideoView超過一切,所以如何解決 – 2018-01-28 13:14:24