I am using Option 2: Use an intent to launch the autocomplete activity
Is it possible to change the "search" place holder text to something such as "enter your city". I found a solution but for javascript, suppose support android as well.
It seems it could be done with a PlaceAutocompleteFragment, but I am using my own EditText to launch autocomplete by using an intent, so it is not helpful.
No there is no way and if you want than you have to create your own. But as u use the EditText(mention in Comment Section) so may be this technique is useful for your.
Code:
PlaceAutocompleteFragment autocompleteFragment;
autocompleteFragment = (PlaceAutocompleteFragment)
getFragmentManager().findFragmentById(R.id.place_autocomplete_fragment);
autocompleteFragment.setOnPlaceSelectedListener(this);
autocompleteFragment.setHint("Search New Location");
XMl :
<LinearLayout
android:layout_width="match_parent"
android:layout_height="@dimen/left_drawable_padding"
android:layout_marginTop="@dimen/margin_five"
android:layout_marginLeft="@dimen/margin_five"
android:layout_marginRight="@dimen/margin_five"
android:background="@drawable/search_background"
android:orientation="vertical">
<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"
/>
and as i used android:background="@drawable/search_background"
so u have to create your own background shape(acc. to your need).
first picture :
Second picture :
thrid picture :
Fourth picture :
Unfortunately, there is no way to change the hint text with the autocomplete intent. You need to make your own widget, like the PlaceAutocompleteFragment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With