Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6796357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:27:28+00:00 2026-05-26T18:27:28+00:00

I am trying to get the map to fill in only the upper half

  • 0

I am trying to get the map to fill in only the upper half of the screen and some other layout in the bottom half. Now I know that this should be possible using weights in combination with a tablelayout. But the same piece of XML code works perfectly with say buttons but not with map.
Screenshots here.

The XML code:

<TableLayout
    android:id="@+id/tableLayout1"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <TableRow
        android:id="@+id/tableRow1"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1" 
        >
            <com.google.android.maps.MapView
            android:id="@+id/map2"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:apiKey="0_z4IHjB6EnXohnoyoudontgoVmhg"
            android:clickable="true" >
        </com.google.android.maps.MapView>

    </TableRow>

    <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1" >
        <Button android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="SECOND"></Button>

    </TableRow>

    <TableRow
        android:id="@+id/tableRow2"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_weight="1" >
        <Button android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:text="SECOND"></Button>
    </TableRow>
</TableLayout>

If you replace the Mapview block by say a button, it will look like the first image in the screenshot, whereas right now it looks like the second one.
In both cases I did not change any weight parameters or layout_width or height, but it somehow changes the size. Any idea how can I have the MapView to cover only half the screen?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T18:27:28+00:00Added an answer on May 26, 2026 at 6:27 pm

    Sorry Urban, gave you a bum steer on it – I had looked at this before and the only way I could limit the map size was programmatically, however, I have since done it with this type of layout:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"     
     android:orientation="vertical" >          
    
     <FrameLayout android:id="@+id/map_frame"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_weight="0.7" >     
    
        <com.google.android.maps.MapView
            android:id="@+id/map_view" 
            android:layout_width="fill_parent"
            android:layout_height="match_parent" 
            android:enabled="true" 
            android:clickable="true"             
            android:apiKey="dgvbdj_my_secret_key_nvc8mxcksos"/>
    
     </FrameLayout>
    
     <co.uk.mycompany.ui.MapNavBar
        android:id="@+id/map_nav"
        android:layout_width="fill_parent"
        android:layout_height="70dip"
        android:layout_gravity="bottom"
        android:layout_weight="0.3" /> 
    

    The last item shown is a custom widget but the layout should show the principles involved. This limited the map height but allowed it to go full width.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to get comfortable with jQuery and I have encountered some sample code that
Trying to get my mind around google protobuf. I found some implementation of protobuf
I am trying to get the best from the excellent open source Mind Map
I am simply trying to get the distance from 2 points on a map
I have a detail view that is pushed from a map. I am trying
I'm trying to get iterator for boost::fusion::map , but I'm missing something. The following
I'm trying to get coordinates of address from google map with Classic Asp. When
I have my map working and displaying correctly. I trying to get it to
I'm trying to fill std::map with std::transform. Next code compiles without error: std::set<std::wstring> in;
I am trying to get a better understanding of the jQuery.map function. So in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.