第一种 代码中去掉
首先找到控件
mSearchFriendEd = (SearchView) getView(R.id.search_friend_ed);
在SearchView的源码中发现 它的下划线分为两段 所以我们要做的就是在SearchView中找到这两个横线 然后给他们隐藏
在自己的页面找到这两个控件
//去掉下划线
mSearchFriendEd.findViewById(android.support.v7.appcompat.R.id.search_plate).setBackground(null);
mSearchFriendEd.findViewById(android.support.v7.appcompat.R.id.submit_area).setBackground(null);
第二种 xmlbu布局文件中去掉
<SearchView
android:id="@+id/search_friend_ed"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_30"
android:layout_weight="1"
android:background="@drawable/ease_seabar_input"
android:iconifiedByDefault="false"
android:queryBackground="@null"
android:searchIcon="@null"
android:showDividers="none"
android:submitBackground="@null"
android:queryHint="查找好友/查找群"></SearchView>
关键的属性就是
android:queryBackground="@null"
android:searchIcon="@null"
android:showDividers="none"
android:submitBackground="@null"