Вам необходимо использовать приведенный ниже код
((autocompleteFragment.getView()!!.findViewById(R.id.places_autocomplete_search_input)) as EditText).textSize = 30.0f
или более Kotlin way,
autocompleteFragment.view?.findViewById<EditText>(R.id.places_autocomplete_search_input)?.textSize = 30.0f
Правильный идентификатор EditText places_autocomplete_search_input
, а не autocomplete_fragment
Анализ проблемы
Вы используете фрагмент com.google.android.libraries.places.widget.AutocompleteSupportFragment
в своем xml
При поиске кода AutocompleteSupportFragment Фрагмент, вы можете видеть, что он использует макет places_autocomplete_fragment.xml
. Код ниже
public class AutocompleteSupportFragment extends Fragment {
....
public AutocompleteSupportFragment() {
super(layout.places_autocomplete_fragment);
....
}
}
Теперь, если вы посмотрите на places_autocomplete_fragment.xml
, вы увидите, что id EditText равен places_autocomplete_search_input
, код ниже
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="true"
android:focusableInTouchMode="true"
android:gravity="center"
android:layoutDirection="locale"
android:orientation="vertical"
android:textDirection="locale">
<ImageButton
android:id="@+id/places_autocomplete_search_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="@null"
android:contentDescription="@string/places_autocomplete_search_hint"
android:padding="@dimen/places_autocomplete_button_padding"
android:src="@drawable/quantum_ic_search_grey600_24" />
<EditText
android:id="@+id/places_autocomplete_search_input"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@null"
android:focusable="false"
android:focusableInTouchMode="false"
android:hint="@string/places_autocomplete_search_hint"
android:inputType="textNoSuggestions"
android:lines="1"
android:maxLines="1"
android:paddingLeft="@dimen/places_autocomplete_search_input_padding"
android:paddingRight="@dimen/places_autocomplete_search_input_padding"
android:singleLine="true"
android:textColor="@color/places_autocomplete_search_text"
android:textColorHint="@color/places_autocomplete_search_hint"
android:textSize="@dimen/places_autocomplete_search_input_text" />
<ImageButton
android:id="@+id/places_autocomplete_clear_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:background="@null"
android:contentDescription="@string/places_autocomplete_clear_button"
android:padding="@dimen/places_autocomplete_button_padding"
android:src="@drawable/quantum_ic_clear_grey600_24" />
</LinearLayout>