我正在尝试自定义与ActionBar的向上按钮相关联的“向上导航”默认contentDescription(我正在使用ActionBarSherlock).
来自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.
我该怎么办?
谢谢