去掉當SearchView得到焦點時候出現的藍色背景線.
SearchView calSearchView = (SearchView)v.findViewById(R.id.calendar_search_view);
if (calSearchView != null) {
try { //--拿到字節碼
Class<?> argClass = calSearchView.getClass();
//--指定某個私有屬性,mSearchPlate是搜索框父佈局的名字
Field ownField = argClass.getDeclaredField("mSearchPlate");
//--暴力反射,只有暴力反射才能拿到私有屬性
ownField.setAccessible(true);
View mView = (View) ownField.get(calSearchView);
//--設置背景mView.setBackgroundColor(Color.TRANSPARENT);
}
catch (Exception e) {
e.printStackTrace();
}}