开发者

Android Google Maps API Frozen Screen

I am trying to make a simple app that utilizes the Google Map API. I followed all the steps on the guides to get the map to generate but when it loads in the emulator it seems frozen and is not navigable. It also does not respond to any further controls like enabling the zoom feature. I am currently using Google API Level 10 (2.3.3). I also know that it is not my debug keystore because I double checked it twice and got the same key both times.

开发者_运维技巧Here is what the layout for the screen I want the map to display on looks like:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent">
  <TextView android:layout_width="wrap_content" android:id="@+id/googleMapsText"           
  android:layout_height="wrap_content" android:text="@string/google_maps"></TextView>
  <com.google.android.maps.MapView
             android:id="@+id/mapView"
             android:layout_width="fill_parent"
             android:layout_height="fill_parent"
             android:apiKey="0F1mnkApH3dcLN2F0bGSIh_oaj2soQyFGSrEN3w"
             />

</RelativeLayout>

My manifest file also has the correct permissions. Here it is:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-library android:name="com.google.android.maps" />  

The code that I am using in my java file to create the maps is also very simple:

private MapView mapView;

/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(R.layout.google_maps);

    mapView = (MapView) findViewById(R.id.mapView);
    mapView.setBuiltInZoomControls(true);


}

Do you have any suggestions for me?


Try to add it to your layout file:

android:clickable = "true"

Now, your map should be movable and zoomable


try to change your layout to somthing very simple, to make sure the issue is not there...
Something like this:

<?xml version="1.0" encoding="utf-8"?>
<com.google.android.maps.MapView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mapview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:apiKey="...your key here..."
/>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜