Android 以编程方式显示actionbar图标图像
在滚动滚动滚动视图时,我正在使用此代码将字母和字体设置为actionbar视图Android 以编程方式显示actionbar图标图像,android,android-actionbar,Android,Android Actionbar,在滚动滚动滚动视图时,我正在使用此代码将字母和字体设置为actionbar视图 int upId = Resources.getSystem().getIdentifier("icon", "id", "android"); if (upId > 0) { ImageView up = (ImageView) findViewById(upId); up.setImageResource(R.drawable.ic_launcher);
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);
嗯,到目前为止还不错,但我想尝试获取actionbar图标,但我无法获取图像视图的标识符。有人能给我一个提示吗?
在您提问之前:我这样做是因为我想让我的应用程序保持尽可能低的sdk。解决方案:
logo = getResources().getDrawable(R.drawable.logo_degradee);
logo.setAlpha(0);
getActionBar().setLogo(logo);
比预期的容易