2014-10-27 77 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); 

更容易接料