Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

To embed google map for android app

Hi I want to use google map in my application but I also want to create own footer menu for it. So it should be looks like header - google map - footer from top to down. I tried to add relativeLayout and linearLayout for embed to mapview but I didnt achieve.

Can you give me an example or tell some way for it?

like image 336
eddie skywalker Avatar asked Mar 23 '11 09:03

eddie skywalker


1 Answers

Read up on the layout weight - http://developer.android.com/guide/topics/ui/layout-objects.html

If you have three views and set the weights to 0, 1 and 0 - then the middle view will resize, the other two will stay a fixed size so it's a good solution for adding header & footer to a resizing view. Try this template code, and note how the layout weights are set:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

        <!-- Header -->
        <TextView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0"
        />

        <!-- Map -->
        <MapView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="1"
            ....
        />

        <!-- Footer, or another embedded Layout -->
        <ImageView
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_weight="0"
        />
</LinearLayout>
like image 138
Ollie C Avatar answered Sep 28 '22 00:09

Ollie C