2013-08-14 2 views
1

Как я могу заставить кнопку быть на вершине видеорекламы, а не над ней? Вот код:Кнопка Android для просмотра на видео

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

Большое спасибо

+1

Вы можете поместить их в 'Framelayout' вместо 'LinearLayout'? – g00dy

ответ

3

вы можете просто использовать это:

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

0

использование ниже

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

Наслаждайтесь :)

+0

Но теперь я не могу видеть кнопку, она должна быть на вершине видео - не ниже этого –

+1

изменить положение кнопки в верхней части видео и попробовать использовать relativelayout –

0

Sanket это right.I расскажет вам, как это работает. мнение, что написано последним в относительной макете является toppest вид, что макет (ось г)

Смежные вопросы