Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

layout_below item inside included layout

I'm trying to figure out a way to align an item in a layout in respect to an item within an included layout.

Here's a visual representation: enter image description here

And here is example code that I'm looking for (which obviously doesn't work):
Main.xml

<?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" >
    <include
        android:id="@+id/info"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        layout="@layout/info" />
    //This would be the dark grey box
    <RelativeLayout
        android:layout_below="@id/item1">
    </RelativeLayout>
</RelativeLayout>

included.xml

<?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="50dp">
    <ImageView
        android:id="@+id/item1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:paddingLeft="100dp"/>
</RelativeLayout>



I'm assuming the best way to accomplish this would be through dynamically positioning the dark grey box in code, but I have no idea where to start. Any help would be awesome.

like image 941
Rawr Avatar asked Sep 26 '12 10:09

Rawr


1 Answers

Can you make this below your include? Something like this (instead item1 use info):

<?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" >
    <include
        android:id="@+id/info"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        layout="@layout/info" />
    //This would be the dark grey box
    <RelativeLayout
        android:layout_below="@id/info">
    </RelativeLayout>
</RelativeLayout>
like image 116
Yury Avatar answered Oct 16 '22 11:10

Yury