使用SearchView
的人都知道,如果自定义了背景,下面还有一条丑丑的下划线,今天跟大家分享一下,如何去掉这个丑丑的下划线。
layout布局
<android.support.v7.widget.SearchView
android:id="@+id/sv_without_underline"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/btn_rect_angle"
/>
Activity
或Fragment
中
private void removeUnderLine() {
SearchView searchView = findViewById(R.id.sv_without_underline);
View viewById = searchView.findViewById(android.support.v7.appcompat.R.id.search_plate);
if (viewById != null) {
viewById.setBackgroundColor(Color.TRANSPARENT);
}
}
广告:
我使用的装备备:程序员必备 | 不伤关节 | 手感好 | 静电容 | Plum键盘|Niz键盘 戳我