Android中的searchView去掉前面的搜索圈

1.声明:

private SearchView mSearchView;

2.初始化:

mSearchView = (SearchView) findViewById(R.id.searchCity_searchView);


3.在对searchView进行findViewById之后,加上如下代码:


int magId = getResources().getIdentifier("android:id/search_mag_icon",null, null);

ImageView magImage = (ImageView) mSearchView.findViewById(magId);

magImage.setLayoutParams(new LinearLayout.LayoutParams(0, 0));


运行不再显示搜索圈




你可能感兴趣的:(Android)