我有這樣的佈局:的Android SurfaceView把所有的空間佈局
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<SurfaceView
android:id="@+id/Preview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp" />
<VideoView
android:id="@+id/videoView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginBottom="20dp"
android:layout_marginLeft="20dp"
android:layout_marginRight="20dp"/>
</LinearLayout>
的SurfaceView和VideoView應該平分的可用空間,並且他們做,如果我把VideoView第一。當我像上面那樣做時,SurfaceView將佔據佈局中的所有空間。 如何避免這種情況,而不給出具體的寬度和高度DPS?
這使得視頻可見,但非常小。如果我增加重量,視頻會變得更大,但不幸的是,從未真正佔用過這個空間。 感謝您的想法! – FWeigl
你必須刪除邊距,同時videoView保持視頻的寬高比,所以在大多數時間它不會填滿所有可用空間。 –