place search dialog
1.0.0
กล่องโต้ตอบการค้นหาสถานที่เติมข้อความอัตโนมัติซึ่งใช้ API สถานที่ของ Google เพื่อค้นหาผลลัพธ์
กล่องโต้ตอบค้นหาสถานที่จากทั่วทุกมุมโลก หากต้องการปรับแต่ง ให้ตั้งค่าขอบเขตตำแหน่งใหม่โดยใช้ .setLatLngBounds(BOUNDS)
PlaceSearchDialog ต้องใช้คีย์ Places API โดย Google คุณสามารถรับได้จากที่นี่
ใช้กล่องโต้ตอบเหมือนเดิม
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 '
}
ตรวจสอบให้แน่ใจว่าคุณมีเวอร์ชัน android-maven-plugin ที่รองรับไฟล์เก็บถาวร aar และเพิ่มการพึ่งพาต่อไปนี้:
< dependency >
< groupId >com.codemybrainsout.placesearchdialog</ groupId >
< artifactId >placesearch</ artifactId >
< version >1.0.0</ version >
< type >pom</ type >
</ dependency >
โครงการนี้ริเริ่มโดย Code My Brains Out คุณสามารถมีส่วนร่วมในโปรเจ็กต์นี้ได้โดยการส่งปัญหาหรือ/และโดยการฟอร์ก Repo นี้และส่งคำขอดึง
ติดตามเราได้ที่:
ผู้เขียน : ราหุล จูนจา
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.