Tôi đang cố gắng tùy chỉnh "Điều hướng" mặc định contentDescription
được liên kết với nút lên của ActionBar
(Tôi đang sử dụng ActionBarSherlock).Đặt contentDescription cho nút ActionBar's up
Từ nguồn ActionBarView
's:
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));
}
}
để chìa khóa sẽ là làm thế nào để có được một tài liệu tham khảo để mHomeLayout
. getWindow().getDecorView().findViewById(android.R.id.home)
không hoạt động vì nó trả về một ImageView.
Tôi làm cách nào?
cám ơn;)