2014-10-27 35 views
0

所以,我使用此代碼來設置alphas和字體到我的操作欄視圖,而我滾動我的scrollview。actionbar圖標圖像programmaticaly

int upId = Resources.getSystem().getIdentifier("icon", "id", "android"); 
    if (upId > 0) { 
     ImageView up = (ImageView) findViewById(upId); 
     up.setImageResource(R.drawable.ic_launcher); 
    } 


    int titleId = getResources().getIdentifier("action_bar_title", "id", "android"); 
    abTitle = (TextView) findViewById(titleId); 
    abTitle.setTextColor(Color.BLACK); 
    abTitle.setAlpha(0); 
    abTitle.setTypeface(tf); 
  • 嗯,到目前爲止好,但我想嘗試讓動作條圖標,我不能夠得到的圖像視圖identifyer。任何人都可以告訴我這個提示嗎?

之前你問:我這樣做,因爲我想保持我的應用程序可能的最低sdk。

回答

0

解決方案:

logo = getResources().getDrawable(R.drawable.logo_degradee); 
    logo.setAlpha(0); 

    getActionBar().setLogo(logo); 

更容易接料