place search dialog
1.0.0
地点自动完成搜索对话框,使用 Google 的地点 API 来查找结果。
该对话框搜索世界各地的位置。要自定义它,请使用.setLatLngBounds(BOUNDS)
设置新的位置边界
PlaceSearchDialog 需要 Google 提供的 Places API 密钥。你可以从这里得到它。
按原样使用对话框
PlaceSearchDialog placeSearchDialog = new PlaceSearchDialog . Builder ( this )
. setLocationNameListener ( new PlaceSearchDialog . LocationNameListener () {
@ Override
public void locationName ( String locationName ) {
//set textview or edittext
}
})
. build ();
placeSearchDialog . show ();
或相应地定制它
PlaceSearchDialog placeSearchDialog = new PlaceSearchDialog . Builder ( this )
. setHeaderImage ( R . drawable . dialog_header )
. setHintText ( "Enter location name" )
. setHintTextColor ( R . color . light_gray )
. setNegativeText ( "CANCEL" )
. setNegativeTextColor ( R . color . gray )
. setPositiveText ( "SUBMIT" )
. setPositiveTextColor ( R . color . red )
. setLatLngBounds ( BOUNDS )
. setLocationNameListener ( new PlaceSearchDialog . LocationNameListener () {
@ Override
public void locationName ( String locationName ) {
//set textview or edittext
}
})
. build ();
placeSearchDialog . show ();
将其添加到您的应用程序 AndroidManifest.xml 中
< meta-data android : name = " com.google.android.geo.API_KEY "
android : value = " YOUR_API_KEY " />
只需将其用作应用程序的 build.gradle 文件中的依赖项即可
dependencies {
compile ' com.codemybrainsout.placesearchdialog:placesearch:1.0.1 '
}
确保您有支持 aar 存档的 android-maven-plugin 版本并添加以下依赖项:
< dependency >
< groupId >com.codemybrainsout.placesearchdialog</ groupId >
< artifactId >placesearch</ artifactId >
< version >1.0.0</ version >
< type >pom</ type >
</ dependency >
该项目由Code My Brains Out发起。您可以通过提交问题或/和分叉此存储库并发送拉取请求来为该项目做出贡献。
关注我们:
作者:拉胡尔·朱尼贾
Copyright (C) 2016 Code My Brains Out
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.