我正在尝试将textColor从我的ActionBar中更改如下:
public void onDrawerOpened(View drawerView) {
getActionBar().setTitle(
Html.fromHtml("<font color='fff'>"
+ mDrawerTitle + "</font>"));
// calling onPrepareOptionsMenu() to hide action bar icons
invalidateOptionsMenu();
}
};以及:
public void onDrawerClosed(View view) {
getActionBar().setTitle(
Html.fromHtml("<font color='fff'>"
+ mTitle + "</font>"));
// calling onPrepareOptionsMenu() to show action bar icons
invalidateOptionsMenu();
}但是它不起作用,我发现您可以修改style.xml,但是我在那里没有任何东西,我的意思是,我只有AppBaseTheme和AppTheme。
你有什么建议给我吗?
发布于 2015-01-05 19:41:58
要么以这种方式使用SpannableString:
String text = "Your text";
SpannableString spannableString = new SpannableString(text);
spannableString.setSpan(new BackgroundColorSpan(Color.parseColor("#ffffff")), 0, text.length(), SpannableString.SPAN_EXCLUSIVE_EXCLUSIVE);
getActionBar().setTitle(spannableString);或者在操作栏的styles.xml文件中设置属性。
https://stackoverflow.com/questions/27786561
复制相似问题