我试图将线性布局内的视频 View 拉伸(stretch)至全屏,但它与设备屏幕不匹配。这是我的代码
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="fill_parent"
android:layout_height="720dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true"
android:layout_gravity="fill_horizontal"
android:layout_marginTop="140dp" >
<VideoView
android:id="@+id/videoView1"
android:layout_width="fill_parent"
android:layout_height="720dp" />
</LinearLayout>
左边和右边总是有 10 到 15 dp 的空间。此外,线性布局不会拉伸(stretch)到全屏。我希望它在宽度上填满屏幕。
最佳答案
实际上不需要编程设置宽度
android:layout_width="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
应该足以用全宽视频 View 填充容器。并使用 match_parent 而不是 fill_parent。希望这对某人有所帮助。
关于安卓全宽视频 View ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15471183/