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.