2016-02-16 11 views
0

enter image description here //改變箭頭的顏色或圖像顯示圖像如何改變如何更改搜索視圖主頁向上箭頭或其在android的顏色?

final Drawable upArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha); 
            upArrow.setColorFilter(getResources().getColor(R.color.app_theme_color), PorterDuff.Mode.SRC_ATOP); 
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {`enter code here` 
            mActionBar.setHomeAsUpIndicator(getResources().getDrawable(R.drawable.arrow)); 
            } 

回答

0

你可以改變圖標像這樣....

希望這有助於...

menu.findItem(R.id.menu_search).setOnActionExpandListener(this); 
    // Your Activity/Fragment must implement the MenuItem.OnActionExpandListener interface 

    @Override 
    public boolean onMenuItemActionExpand(MenuItem item) { 
     getSherlockActivity().getSupportActionBar().setIcon(R.drawable.uvweb_logo); 
     return true; 
    } 
+0

我設置圖標,但我想刪除該箭頭的更改或顏色更改或圖標更改 –

相關問題