How to remove white underline in a SearchView widget in Toolbar Android

后端 未结 10 2073
挽巷
挽巷 2020-12-01 03:33

I am using Toolbar search widget in my project. Everything works fine but expect the thing which I am completely stuck up with removing the underline below search field in m

10条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-01 03:43

    First you should get the bottom line simply like this:

    searchPlate = (View) findViewById(R.id.search_plate);
    

    Then you should set background color to transparent like this:

    searchPlate.setBackgroundColor(Color.TRANSPARENT);
    

    This works perfectly for androidx.appcompat.widget.SearchView!

提交回复
热议问题