替換Action bar系統圖標

#替換Action bar系統圖標android

##替換Overflow圖標code

新建一個styleget

<style name="OverFlow" parent="android:Widget.ActionButton.Overflow">
    <item name="android:src">@drawable/ic_more_vert_white_24dp</item>
</style>

而後在AppTheme里加上:it

<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar">
    <item name="android:actionOverflowButtonStyle">@style/OverFlow</item>    
</style>

##替換SearchView圖標io

SearchView的圖標須要在代碼裏面修改co

final SearchView searchView = (SearchView)menu.findItem(R.id.options_menu_search).getActionView();
int searchImgId = getResources().getIdentifier("android:id/search_button", null, null);
ImageView v = (ImageView) searchView.findViewById(searchImgId);
v.setImageResource(R.drawable.ic_search_white_24dp);
相關文章
相關標籤/搜索