1

How can i get the button to be on top of the video view instead of above it? Here's the code:

<?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" 
>

<Button
    android:id="@+id/btnHD"
    style="@style/btnStyleGenoa"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Turn HD On" />

<VideoView
    android:id="@+id/videoView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal" />
</LinearLayout>

Many Thanks

Sanket Kachhela
  • 10,861
  • 8
  • 50
  • 75
Tom Doe
  • 331
  • 6
  • 23

3 Answers3

3

you can simply use this:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >

<VideoView
    android:id="@+id/videoView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal" />

<Button
    android:id="@+id/btnHD"
    style="@style/btnStyleGenoa"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true"
    android:layout_marginBottom="17dp"
    android:text="Turn HD On" />

Shani Goriwal
  • 2,111
  • 1
  • 18
  • 30
0

use below

<?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" 
>
<Button
    android:id="@+id/btnHD"
    style="@style/btnStyleGenoa"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:text="Turn HD On" />

<VideoView
    android:id="@+id/videoView1"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal" />



 </RelativeLayout >

Enjoy :)

Sanket Kachhela
  • 10,861
  • 8
  • 50
  • 75
0

Sanket is right.I will tell you how it works. The view which is written last in Relative layout is the toppest view of that layout(z-axis)

Abhishek Birdawade
  • 301
  • 1
  • 2
  • 14