I try to put a ListView and a MapView side by side using RelativeLayout. However my MapView is always above the ListView.
Here is my main.xml layout:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<com.google.android.maps.MapView
android:id="@+id/mapview"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:clickable="true"
android:apiKey="0uZMgFMDqZETDVYg843CSoC8rHyuV01ypwz2C2Q"
android:layout_alignParentRight="true" android:layout_alignParentTop="true" />
<ListView android:id="@+id/list" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:smoothScrollbar="true"
android:background="#fff" android:cacheColorHint="#fff"
android:fastScrollEnabled="false" android:clickable="true"
android:layout_alignParentLeft="true" android:layout_alignParentTop="true"
android:layout_marginBottom="36dp" />
</RelativeLayout>
Better Use
TableLayoutspecify android:layout_weight=”1″ in both MapView and ListViewIf you use Relative Layout then you have to set maximum width to both listview and map view programmatically