Video View Layout issues
I'm trying to create a Dialog box that will display a video (quick tutorial) before the first levels
I got the video and the view working fine but I have a problem in the layout of my dialog.
here is what I want:
A video view centered horizontally and taking as much space as it can.
Under that a button Play.
Unfortunately I can't get that for some reason.
I think it comes from the video view not 开发者_开发问答being launched at the moment of the creation.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:orientation="vertical">
<LinearLayout
android:id="@+id/test"
android:gravity="center_horizontal"
android:orientation="horizontal"
android:layout_alignParentTop="true"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<VideoView android:id="@+id/video"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
</VideoView>
</LinearLayout>
<Button android:id="@+id/Button01" android:layout_below="@+id/video"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:layout_centerHorizontal="true" android:text="Cancel" />
</LinearLayout>
this is the closest I got to but its still no good
Hope you can help
Jason
Try this:
<RelativeLayout android:id="@+id/test"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<Button android:id="@+id/Button01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:text="Cancel" />
<VideoView android:id="@+id/video"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_above="@id/Button01"
android:layout_centerInParent="true" />
</LinearLayout>
Just add following property to LinearLayout-Test and Button-Button01..
android:layout_weight="1"
精彩评论