- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
我已经在 Activity 中实现了 PlaceAutocompleteFragment 并且工作成功。但是如何在android的 fragment 中实现相同的功能?我已经实现了这样的 placeautocomplete fragment
PlaceAutocompleteFragment autocompleteFragment1 = (PlaceAutocompleteFragment)
getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment1);
我得到的错误是
Incovertible types;cannot cast 'android.support.v4.app.Fragment' to com.google.android.gms.location.PlaceAutocompleteFragment '.
XML 布局是
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/button_background"
card_view:cardCornerRadius="4dp"
card_view:contentPadding="0dp">
<fragment
android:id="@+id/place_autocomplete_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Place"
android:background="#fff"
android:name="com.google.android.gms.location.places.ui.PlaceAutocompleteFragment"
/>
</android.support.v7.widget.CardView>
提前致谢
最佳答案
像这样使用getActivity()
。
PlaceAutocompleteFragment autocompleteFragment1 = (PlaceAutocompleteFragment)getActivity().getFragmentManager().findFragmentById(R.id.autocomplete_fragment1);
关于android - 将 PlaceAutocompleteFragment 添加到 fragment 会引发错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36996672/
我想实现 AutocompleteTextView(google places),但是当我点击 fragment 中的 searchView 时, fragment 消失了(掉下来)。 我的代码:
有没有什么方法可以使用 Google Places API 中的 placeautocompletefragment 获取在搜索 View 中显示的完整地址?它只显示整个地址的第一部分。我确信一切都已
在我的应用程序中,我添加了 Google map ,它们运行良好。我想添加一个 PlaceAutocompleteFragment。我正在使用我已经为 map 生成的 key ,并且我已经从 goog
如何解决PlaceAutocompleteFragment? 我正在尝试使用新的 PlaceAutocompleteFragment。我尝试使用以下代码: 此代码示例只是一个副本。来自这里site
这是我的 .xml 文件 我添加了 PlaceAutocompleteFragment,但它显示未解析的类 PlaceAutocompleteFragment。我检查了依赖文件,所有的东西都被添加了。
在我的应用程序主页中,google place auto complete fragment 在对话框栏内按下按钮打开,该位置用于搜索查询。问题是当我尝试通过再次按下按钮来更改位置时,应用程序崩溃并出
我在 setHint 方法上收到 NPE。Logcat 显示此错误: void android.widget.EditText.setHint(java.lang.CharSequence)' on
我想在 Activity 加载完成后立即自动点击 fragment 。 fragment 定义为: 我试过这样做 fragment = findViewById(R.id.place_autoco
我在最近的一个项目中使用了 Google 的 PlaceAutoCompleteFragment,目前我正在从事这项工作。当我快速单击 PlaceAutoCompleteFragment 时,它会在我
我想在我的 Android 应用程序中实现 placeautocompletefragment。我正在尝试使用 this url 中的说明但它显示: can not resolve symbol fo
我正在使用 PlaceAutocompleteFragment 来搜索地点。下面是我的xml代码 我想删除默认带有 fragment 的搜索图标。 最佳答案 您可以使用这一行来获取搜索图标的引用:(
我正在使用 Google Places API for Android - PlaceAutocompleteFragment 我项目中用于搜索位置的 API,当用户选择一个位置然后使用位置经纬度获取
我正在使用 Google Place获取地点详情。 Google 提供了不同的方式来实现 Google Place API 以获取地点详细信息。不同的方式如 PlaceAutocompleteFrag
我在 Fragment 中使用 PlaceAutoCompleteFragment。第一次打开 Fragment(放置 PlaceAutoCompleteFragment 的 App fragment
我想实现 PlaceAutocompleteFragment based on the docs,在我的应用程序中,但是当我添加此代码段时 最后一行抛出“无法解析符号‘PlaceAutocomple
我已经在 Activity 中实现了 PlaceAutocompleteFragment 并且工作成功。但是如何在android的 fragment 中实现相同的功能?我已经实现了这样的 placea
我正在尝试将 PlaceAutocompleteFragment 添加到我的 Activity 中,这是我正在使用的所有导入: import com.google.android.gms.common
我在 fragment 中使用 PlaceAutoCompleteFragment。第一次打开 Fragment(其中放置了 PlaceAutoCompleteFragment 的 App fragm
我正在按照官方文档 here 尝试将一个 Place Autocomplete fragment 添加到我的 fragment 中 我收到错误 kotlin.TypeCastException: nu
我正在尝试使用 Google 的地点自动完成 ( https://developers.google.com/places/android-api/autocomplete ) 在我的应用程序中的 f
我是一名优秀的程序员,十分优秀!