android - 我如何设计新地方 AutocompleteSupportFragment

标签 android android-layout

有没有关于如何设置样式的引用?我没有在开发人员文档中找到任何内容。任何帮助将不胜感激。

最佳答案

首先,通过以下方式获取 fragment 的 View :

AutocompleteSupportFragment autocompleteFragment = (AutocompleteSupportFragment)
            getSupportFragmentManager().findFragmentById(R.id.autocomplete_fragment);
View view = autocompleteFragment.getView();

获取放大镜图标的 ImageButton View :

  ImageButton searchButton = view.findViewById(com.google.android.libraries.places.R.id.places_autocomplete_search_button);

获取 EditText View ,将“Search”作为提示写入:

  EditText editText = view.findViewById(com.google.android.libraries.places.R.id.places_autocomplete_search_input);

关于android - 我如何设计新地方 AutocompleteSupportFragment,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56021363/

相关文章:

java - 为什么我的 Activity 在添加 fragment 时会被破坏?

java - 向自定义工具栏添加后退按钮的最佳方法是什么?

Android - 与 android :id 具有不同 ID 的 fragment

android - 按钮应该粘在底部,带有 adjustResize

java - TextView 对齐两行

android - 如何在Android操作系统中自定义iptable源代码版本4.0.4

java - 在android开发中使用命令行安装ffmpeg库

android - 意外的顶级异常 : On Android Studio and not Eclipse

android - 如何在android中用手指在imageview上画线

android - AutoCompleteTextView 函数 afterTextChanged 每次都会调用