Results 1 to 2 of 2
  1. #1
    Seated is offline Member
    Join Date
    Feb 2014
    Posts
    2
    Rep Power
    0

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

    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:

    Java Code:
    public class MainActivity extends Activity {
     
    
            private GoogleMap googleMap;
         
            @Override
            protected void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                setContentView(R.layout.activity_main);
         
                try {
                    initilizeMap();
         
                } catch (Exception e) {
                    e.printStackTrace();
                }
         
            }
            private void initilizeMap() {
                if (googleMap == null) {
                    googleMap = ((MapFragment) getFragmentManager().findFragmentById(
                            R.id.map)).getMap();
         
                }
            }
         
            @Override
            protected void onResume() {
                super.onResume();
                initilizeMap();
            }
         
        }


    Android xml:

    Java Code:
        <?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" >
         
            <fragment
                android:id="@+id/map"
                android:name="com.google.android.gms.maps.MapFragment"
                android:layout_width="match_parent"
                android:layout_height="match_parent"/>
         
        </RelativeLayout>



    Image:

  2. #2
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,058
    Rep Power
    5

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

    You need another element in your XML as a peer to the map fragment. Perhaps another layout containing your text views or buttons or whatever you want in the box.
    Get in the habit of using standard Java naming conventions!

Similar Threads

  1. text components and key and input maps
    By willemjav in forum Advanced Java
    Replies: 5
    Last Post: 10-27-2013, 01:28 PM
  2. how to create an array of maps
    By lalossa in forum New To Java
    Replies: 4
    Last Post: 02-17-2013, 01:16 PM
  3. Google Earth or Maps in GUI
    By spyroth in forum SWT / JFace
    Replies: 1
    Last Post: 02-12-2011, 07:24 PM
  4. google maps static api on java se
    By shubham.velocity in forum Networking
    Replies: 2
    Last Post: 11-14-2010, 10:09 PM
  5. Google Maps API
    By mew in forum New To Java
    Replies: 0
    Last Post: 12-26-2007, 10:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •