brian
brian

Reputation: 6912

Android layout priotity

My xml code:

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

    <RelativeLayout
        android:id="@+id/relativeLayout2"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:visibility="invisible">


        <ImageButton
            android:id="@+id/video_playback_pause"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>


        <SeekBar
            android:id="@+id/seekbar_video"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" android:layout_below="@id/video_playback_pause" android:clickable=""/>

    </RelativeLayout>

    <VideoView
        android:id="@+id/videoView1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_centerInParent="true" />

</RelativeLayout>

Now whe RelativeLayout and VideoView override. the VideoView is show, and the RelativeLayout is hidden. How to make the RelativeLayout on the top of VideoView?

Another problem is why the seekbar did not click?

I find that the priority of layout is decide by establish order? But the problem of seekbar is still not resolve.

Upvotes: 0

Views: 889

Answers (3)

anju_john
anju_john

Reputation: 76

Answer for the first part of question.
android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_centerInParent="true"> The inner relativeLayout's visibility is set to invisible.Remove it.

You have provided android:clickable="" for seekbar. May be thats why its not working. Remove that and try.

Hope this will help you.

Upvotes: 1

vnshetty
vnshetty

Reputation: 20132

Try this...

 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/RelativeLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<RelativeLayout
    android:id="@+id/relativeLayout2"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" >


    <ImageButton
        android:id="@+id/video_playback_pause"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>


    <SeekBar
        android:id="@+id/seekbar_video"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" android:layout_below="@+id/video_playback_pause" android:clickable="true"/>

</RelativeLayout>

<VideoView
    android:id="@+id/videoView1"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true" />

 </LinearLayout>

EDIT:

You can use the visibilty property as below

android:visibility="invisible" // invisible- just invisible the controls not the space
                               //gone - removes the allocated space too
                               //visible- shows the control

At run time also you can change

mylayout.setVisibilty(View.GONE)...

Upvotes: 1

Ghost
Ghost

Reputation: 3966

When it comes to your seekbar, this could be the possible answer: Set

android:clickable="true" 

and in your java code, try putting an Event Listener. For Event Listeners, http://developer.android.com/guide/topics/ui/ui-events.html

When it comes to your layout, you can try using a Linear Layout and then nest a Relative Layout inside it. You might have to change your xml a bit.

Upvotes: 1

Related Questions