By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,581 Members | 1,990 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,581 IT Pros & Developers. It's quick & easy.

How do I create a box to hold text below Google maps within android?

P: 2
At this point I know how to utilize Google Maps within Android but it always seems to take up the full window, there is an image below which shows what I'm attempting to accomplish (having a box below the Google maps where I can store text i.e. "Hello World"

How do I add box below Google Maps, so to store text i.e. "Hello World"

Code so far:

ActivityMain:

Expand|Select|Wrap|Line Numbers
  1. public class MainActivity extends Activity {
  2.  
  3.  
  4.         private GoogleMap googleMap;
  5.  
  6.         @Override
  7.         protected void onCreate(Bundle savedInstanceState) {
  8.             super.onCreate(savedInstanceState);
  9.             setContentView(R.layout.activity_main);
  10.  
  11.             try {
  12.                 initilizeMap();
  13.  
  14.             } catch (Exception e) {
  15.                 e.printStackTrace();
  16.             }
  17.  
  18.         }
  19.         private void initilizeMap() {
  20.             if (googleMap == null) {
  21.                 googleMap = ((MapFragment) getFragmentManager().findFragmentById(
  22.                         R.id.map)).getMap();
  23.  
  24.             }
  25.         }
  26.  
  27.         @Override
  28.         protected void onResume() {
  29.             super.onResume();
  30.             initilizeMap();
  31.         }
  32.  
  33.     }


Android xml:

Expand|Select|Wrap|Line Numbers
  1.     <?xml version="1.0" encoding="utf-8"?>
  2.     <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3.         android:layout_width="fill_parent"
  4.         android:layout_height="fill_parent" >
  5.  
  6.         <fragment
  7.             android:id="@+id/map"
  8.             android:name="com.google.android.gms.maps.MapFragment"
  9.             android:layout_width="match_parent"
  10.             android:layout_height="match_parent"/>
  11.  
  12.     </RelativeLayout>



Image:

Feb 19 '14 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.