在Google Places提供的android PlaceAutocompleteFragment Search小部件中,结果彼此重叠 [英] Results are coming one over another in android PlaceAutocompleteFragment Search widget Provided by Google Places

查看:114
本文介绍了在Google Places提供的android PlaceAutocompleteFragment Search小部件中,结果彼此重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已使用Google Places Api提供的PlaceAutocompleteFragment将Autocomplete搜索集成到我的Android应用程序中. 它工作正常,但问题是有时自动完成列表中的结果是一个接一个的. 我无法考虑这个问题.我要为其添加屏幕截图和代码.

I have used PlaceAutocompleteFragment provided by Google Places Api to integrate Autocomplete search in my Android Application. It is working fine but the problem is sometime the results in autocomplete list is coming one over another. I am not able to think about the issue. I am adding the screenshot and code for the same.

问题的屏幕截图

代码-

布局代码-

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/coord"
    android:fitsSystemWindows="true"
    tools:context="com.restaurantfinder.lazylad91.restaurantfinder.HomeActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/AppTheme.PopupOverlay">
            <fragment
                android:id="@+id/place_autocomplete_fragment"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment"
                />
        </android.support.v7.widget.Toolbar>
    </android.support.design.widget.AppBarLayout>

    <include layout="@layout/content_home"/>

<!--    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_dialog_email"/>-->

</android.support.design.widget.CoordinatorLayout>

活动代码-

    AutocompleteFilter typeFilter = new AutocompleteFilter.Builder()
            .setTypeFilter(AutocompleteFilter.TYPE_FILTER_ESTABLISHMENT)
            .build();
    autocompleteFragment.setFilter(typeFilter);

    autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
        @Override
        public void onPlaceSelected(Place place) {
            // TODO: Get info about the selected place.
            mPlaceSelected = place;

            }
            Log.d("TAG", "Place: " + place.getName());//get place details here
        }

更新

此错误已由有问题的Google处理

This bug was handled by Google in issue

https://issuetracker.google.com/issues/35829225

此修复程序已在Google Play服务9.6(2016年9月21日)中实现

The fix was implemented in Google Play Services 9.6 (21 Sep 2016)

推荐答案

这是Android的自动完成"小部件中的一个已知问题.它将在即将发布的版本中修复.

This is a known issue in the Autocomplete widget for Android. It will be fixed in an upcoming release.

这篇关于在Google Places提供的android PlaceAutocompleteFragment Search小部件中,结果彼此重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆