Question

I've searched for an answer for this all over but the solutions offered did not solve my problem.

I have a layout where I display some views (a few buttons and a background). To this i've added a custom control i've made extending linear layout. This control is displayed above the layout quite nicely. What I wish to do is add an additional ImageView which is larger than this control but it will be in front of it.

edited: Sorry, I hope this will clear things up.

I have one large layout (Relative) for my activity, I would like to stack on this layout two additional views\layout so the final version will be the picture attached:

enter image description here

This is my layout - which stacks the imageview right on the menubar, and not over the others. Trying to put the FrameLayout elsewhere still didn't give me the wanted result.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background">
    <RelativeLayout android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="450dip">
        <com.myproject.controls.SearchControl
            android:id="@+id/scSearch" 
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
        />
        <ExpandableListView android:id="@+id/lstItems"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_below="@id/scSearch"
            android:layout_marginLeft="26dip"
        />
    </RelativeLayout>
    <FrameLayout android:layout_width="fill_parent"
            android:layout_height="fill_parent">
    <com.myproject.controls.MenubarMain
        android:id="@+id/mbMenuBarMain"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="bottom"
    />
    <ImageView android:src="@drawable/myicon"
                android:layout_width="200dip"
                android:layout_height="200dip"
                />
    </FrameLayout>
</LinearLayout>
Was it helpful?

Solution

Not sure it this will work or not cause I'm typing this up at work. But moral of the story here is get used to using RelativeLayout. You have much more control over your layout.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@drawable/background">
    <com.myproject.controls.MenubarMain
        android:id="@+id/mbMenuBarMain"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true">
    </com.myproject.controls.MenubarMain>
    <com.myproject.controls.SearchControl
        android:id="@+id/scSearch" 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true">
    </com.myproject.controls.SearchControl>
    <ExpandableListView android:id="@+id/lstItems"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@id/scSearch"
        android:layout_above="@id/mbMenuBarMain"
        android:layout_paddingLeft="26dp"/>
    <ImageView android:src="@drawable/myicon"
            android:layout_width="200dp"
            android:layout_height="200dp"
            android:layout_alignBottom="@id/mbMenuBarMain"
            android:layout_alignRight="@id/mbMenuBarMain"/>
</RelativeLayout>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top