Issue
I have a RelativeLayout in which is a MapView. I'm trying now to set a LinearLayout above this MapView, so I mean on the Top, but the MapView shall fill the whole screen.
The problem is now that the MapView is shown, but the LinearLayout with the id "map_zoomcontrols" is hidden.
Is there a way to bring the LinearLayout to the front?
<?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">
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map_zoomcontrols"
android:layout_width="200dp"
android:layout_height="150dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="#fff"
android:gravity="center_horizontal">
<Button
android:id="@+id/map_zoom_out"
android:layout_width="70dp"
android:layout_height="30dp"
android:text="Out"
android:textColor="#fff"
android:background="#fff"
/>
<Button
android:id="@+id/map_zoom_in"
android:layout_width="70dp"
android:layout_height="30dp"
android:text="In"
android:textColor="#fff"
android:background="@drawable/button_shape_selector"
/>
</LinearLayout>
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:apiKey="..."/>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/bottom_ll"
android:orientation="horizontal"
android:layout_width="400dp"
android:layout_height="45dp"
android:gravity="center_horizontal"
android:background="@drawable/gradient"
android:layout_alignParentBottom="true"
>
<Button android:id="@+id/btn_bottom"
android:layout_width ="120dp"
android:layout_height="35dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:text="Bottom"
android:textColor="#fff"
android:background="@drawable/button_shape_selector"/>
</LinearLayout>
Solution
Put the LinearLayout
after the MapView
control in the xml layout:
<?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">
<com.google.android.maps.MapView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/mapview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="true"
android:apiKey="..."/>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/map_zoomcontrols"
android:layout_width="200dp"
android:layout_height="150dp"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:background="#fff"
android:gravity="center_horizontal">
<Button
android:id="@+id/map_zoom_out"
android:layout_width="70dp"
android:layout_height="30dp"
android:text="Out"
android:textColor="#fff"
android:background="#fff"
/>
<Button
android:id="@+id/map_zoom_in"
android:layout_width="70dp"
android:layout_height="30dp"
android:text="In"
android:textColor="#fff"
android:background="@drawable/button_shape_selector"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/bottom_ll"
android:orientation="horizontal"
android:layout_width="400dp"
android:layout_height="45dp"
android:gravity="center_horizontal"
android:background="@drawable/gradient"
android:layout_alignParentBottom="true"
>
<Button android:id="@+id/btn_bottom"
android:layout_width ="120dp"
android:layout_height="35dp"
android:layout_marginLeft="5dp"
android:layout_marginTop="5dp"
android:text="Bottom"
android:textColor="#fff"
android:background="@drawable/button_shape_selector"/>
</LinearLayout>
Answered By - user
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.