Example of FrameLayout - Blog Android

Friday, 24 June 2011

Example of FrameLayout

It's a example of using FrameLayout, to make two view (a SeekBar and a SurfaceView here) overlap.

Example of FrameLayout

It use the old post "Implement a SeekBar to control the volume of Video Player" as a example. The Java code keep no change, modify the layout file, main.xml, to move the Volumn Control (SeekBar) over the top of the video(SurfaceView).

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/hello"/>
<LinearLayout
android:orientation="horizontal"
android:layout_height="wrap_content"
android:layout_width="fill_parent">
<Button
android:id="@+id/playvideoplayer"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="- PLAY Video -"
/>
<Button
android:id="@+id/pausevideoplayer"
android:layout_width="0dip"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="- PAUSE Video -"/>
</LinearLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<SurfaceView
android:id="@+id/surfaceview"
android:layout_width="fill_parent"
android:layout_height="wrap_content"/>
<SeekBar
android:id="@+id/volbar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_margin="10px"/>
</FrameLayout>
</LinearLayout>


Borneo08

About Borneo08

Author Description here.. Nulla sagittis convallis. Curabitur consequat. Quisque metus enim, venenatis fermentum, mollis in, porta et, nibh. Duis vulputate elit in elit. Mauris dictum libero id justo.

Subscribe to this Blog via Email :

More links

Related Posts Plugin for WordPress, Blogger...