我正在尝试自定义与(我正在使用 ActionBarSherlock)contentDescription
的向上按钮关联的“向上导航”默认值。ActionBar
来自ActionBarView
的来源:
public void setHomeButtonEnabled(boolean enable) {
mHomeLayout.setEnabled(enable);
mHomeLayout.setFocusable(enable);
// Make sure the home button has an accurate content description for accessibility.
if (!enable) {
mHomeLayout.setContentDescription(null);
} else if ((mDisplayOptions & ActionBar.DISPLAY_HOME_AS_UP) != 0) {
mHomeLayout.setContentDescription(mContext.getResources().getText(
R.string.abs__action_bar_up_description));
} else {
mHomeLayout.setContentDescription(mContext.getResources().getText(
R.string.abs__action_bar_home_description));
}
}
所以关键是如何获得对mHomeLayout
. getWindow().getDecorView().findViewById(android.R.id.home)
不工作,因为它返回一个 ImageView。
我该怎么办?
谢谢 ;)