【问题标题】:Customize Search interface - icon and text自定义搜索界面 - 图标和文本
【发布时间】:2017-10-31 17:19:32
【问题描述】:

我们的 Android 应用有一个持久的搜索栏,但我们想自定义图标(放大镜)和默认的“搜索”文本。任何见解将不胜感激。

【问题讨论】:

    标签: android search customization


    【解决方案1】:

    您可以从写在 res/menu 目录中的菜单 xml 文件中自定义搜索图标

    <menu xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools" tools:context=".MainActivity">
        <item android:id="@+id/action_search"
            android:title="@string/action_search"
            android:icon="@drawable/ic_search_white_24dp"
            app:showAsAction="collapseActionView|always"/>
    
    </menu>
    

    【讨论】:

      猜你喜欢
      • 2016-02-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-18
      • 2014-11-23
      • 1970-01-01
      • 2012-10-12
      • 1970-01-01
      相关资源
      最近更新 更多