谷歌地图v2,自动完成功能无法正常工作

问题描述 投票:-1回答:1

每次我尝试搜索某个地方时,我的自动填充功能都无效。

Android监视器:

我们是CML:

<android.support.v7.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:alignmentMode="alignBounds"
    app:orientation="horizontal"
    android:padding="16dp"
    app:useDefaultMargins="true"
    app:columnCount="1" >

    <TextView
        android:id="@+id/from_label"
        app:layout_gravity="fill_horizontal"
        android:text="@string/from"
        android:textColor="?android:textColorSecondary" />


    <com.ecs.google.maps.v2.fragment.CustomAutoCompleteTextView
        android:id="@+id/from"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        />

    <TextView
        android:id="@+id/to_label"
        app:layout_gravity="fill_horizontal"
        android:text="@string/to"
        android:textColor="?android:textColorSecondary" />


    <com.ecs.google.maps.v2.fragment.CustomAutoCompleteTextView
        android:id="@+id/to"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        />

    <Button
        android:id="@+id/load_directions"
        app:layout_columnSpan="@integer/create_account_pane_column_count"
        app:layout_gravity="fill_horizontal"
        android:text="@string/load_directions" />

</android.support.v7.widget.GridLayout>

AndroidManifest:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.kixkikx.testzng">

    <!--
         The ACCESS_COARSE/FINE_LOCATION permissions are not required to use
         Google Maps Android API v2, but you must specify either coarse or fine
         location permissions for the 'MyLocation' functionality. 
    -->
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

    <permission
        android:name="com.ecs.google.maps.v2.actionbarsherlock.permission.MAPS_RECEIVE"
        android:protectionLevel="signature" />

    <uses-permission android:name="com.example.mapdemo.permission.MAPS_RECEIVE" />

    <!-- Network connectivity permissions -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />


    <!-- Access Google based webservices -->
    <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />

    <!-- External storage for caching. -->
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

    <!-- My Location -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-feature
        android:glEsVersion="0x00020000"
        android:required="true" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/Theme.Sherlock.Light" >

        <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="AIzaSyDK1zxUEp38e6sQYzJq6qGNKxdOUqUZR1Y"/>

        <uses-permission android:name="android.permission.INTERNET"/>
        <activity
            android:name="com.ecs.google.maps.v2.actionbarsherlock.TabbedActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.ecs.google.maps.v2.fragment.DirectionsInputActivity"
            android:label="@string/directions_input" >
        </activity>
    </application>
</manifest>
android google-maps google-maps-android-api-2 google-maps-api-2
1个回答
0
投票

好吧,请确保您在开发者控制台中同时启用了适用于Android的Google Places API和Google Places API Web服务。因为有时候问题是自动填充无法解决的问题。此外,尝试使用浏览器密钥。参考:Google maps API auto complete is not working

© www.soinside.com 2019 - 2024. All rights reserved.