place search dialog
1.0.0
結果の検索に Google の Place API を使用する、Place オートコンプリート検索ダイアログ。
ダイアログは世界中の場所を検索します。カスタマイズするには、 .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.