我已经在我的安卓应用程序中实现了谷歌的PlaceAutocompleteFragment,如下所示。

但我想在最后添加一个按钮--谷歌地图是如何配备麦克风的。

下面是到目前为止我的代码:
<android.support.v7.widget.CardView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="8dp"
>
<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.CardView>地点选择代码:
autocompleteFragment.setOnPlaceSelectedListener(new PlaceSelectionListener() {
@Override
public void onPlaceSelected(Place place) {
String placeName = place.getName().toString();
LatLng latLng = place.getLatLng();
mMap.addMarker(new MarkerOptions().position(latLng).title(placeName));
mMap.animateCamera(CameraUpdateFactory.newLatLng(latLng));
}
@Override
public void onError(Status status) {
// TODO: Handle the error.
Log.i(TAG, "An error occurred: " + status);
}
});一个示例代码就好了。(非常感谢:)
发布于 2016-12-29 15:56:48
很抱歉这么晚才回复,但是由于一些错误,我已经重新安装并下载了整个Android和SDK
以下是我对你的建议:-
https://stackoverflow.com/questions/41336736
复制相似问题