Using Android Studio default search icon for searchView

10,402

You can also access this list of icons in https://material.io/icons/ from Android Studio

enter image description here

enter image description here

Share:
10,402
iBEK
Author by

iBEK

Updated on June 14, 2022

Comments

  • iBEK
    iBEK almost 2 years

    Can't seem to find the right search icon for the searchView for my actionBar. Does Android Studio even offer a non-bad one or do I have to create my own?

    Here's what's offered in Android Studio: ( I want to have all white icons)

    android:icon="@android:drawable/ic_menu_search" 
    

    enter image description here

    This search icon doesn't work for me.

    ===============================================

    Here's another Android Studio icon that won't work with my white icons:

    android:icon="@android:drawable/ic_search_category_default"
    

    enter image description here

    ==============================================

    android:icon="@drawable/ic_search_black_24dp"
    

    The final Android Studio available search icon from Image Asset Folder --> Clip Art. It's finally a white icon but it's positioned higher than the settings icon. Don't know why.

    enter image description here

    I need a white icon like the last one but to be in the same position as the settings Icon. Is there any way to lower icon without making it look odd on other phones? Do I have to create my own icon and if so, what sizes? Why does Android Studio put the white search Icon so high up compared to others?

    • Mohammed Gamal
      Mohammed Gamal over 6 years
    • iBEK
      iBEK over 6 years
      Are these open source?
    • Mohammed Gamal
      Mohammed Gamal over 6 years
      Yes you can use them in your app
    • iBEK
      iBEK over 6 years
      Whatever, I don't find in Android Studio, i'll certainly consider using these material icons, thank you.
    • Mohammed Gamal
      Mohammed Gamal over 6 years
      Check my answer
  • iBEK
    iBEK over 6 years
    My 3rd and white search icon above is from Image Asset folder.
  • Mohammed Gamal
    Mohammed Gamal over 6 years
    Do You have layout for the action bar ?
  • Mohammed Gamal
    Mohammed Gamal over 6 years
    Yeah I Know , Try To Download the search icon from the website and use it with size 48Dp and check
  • Mohammed Gamal
    Mohammed Gamal over 6 years
    You can add custom view for action bar LayoutInflater inflator = (LayoutInflater) this .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View v = inflator.inflate(YOUR VIEW, null); actionBar.setCustomView(v);
  • iBEK
    iBEK over 6 years
    Alright, thank you, i'll give it a try. Thanks for all your help.
  • Mohammed Gamal
    Mohammed Gamal over 6 years
    You are welcome :) , If it worked don't forget to vote up :)