How to precisely align the magnifying glass icon in SearchView?

I want to configure Android SearchViewby default so that it looks like this: enter image description here

I could use reflection to access propeties SearchViewand use ImageSpan to add a magnifying glass icon before β€œSearch” (tooltip text), and then set it as the tooltip text for SearchViewEditText.

But I also need a magnifier to align in SearchView with exact pixel values, as shown in the image above. I do not yet know how to do this.

How can I implement it?

+4
source share

All Articles