【发布时间】:2015-02-24 20:18:12
【问题描述】:
我只见过询问如何全屏显示 VideoView 的问题,但我想做的是将视频播放作为活动的一部分,并在页面上添加一些附加元素。我该怎么做呢?我似乎无法控制 VideoView 的大小,我只能在设计器中移动它。
编辑:附加信息
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
tools:context="com.MyActivity">
<Button
Default button Stuff
/>
<TextView
Default textview stuff
/>
<VideoView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/videoView"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="50dp"
android: />
</RelativeLayout>
就理想比例而言,可能是 500 x 400 dp?了解流程后,我就可以玩数字了。
【问题讨论】:
-
在编辑器窗口,在设计器底部,点击“文本”按钮直接编辑xml。
-
@petey 我要修改什么属性?我没有看到 maxWidth/maxHeight
-
maxWidth/maxHeight 仅适用于某些视图,例如 TextView 及其子类。如果您希望在这些类型的视图上使用此功能,请将缺少的行添加到您的 xml.xml 文件中。否则,请考虑使用布局权重。
-
为了进一步帮助您,您能否编辑您的问题,向我们提供您现在拥有的 xml,以及您正在寻找的内容的详细信息(视频视图应该与屏幕)。
-
@petey 我做了一些编辑,我只是想做一些非常基本的事情。
标签: android android-studio android-videoview