Java Code Examples for android.support.v7.widget.Toolbar#setNavigationContentDescription()
The following examples show how to use
android.support.v7.widget.Toolbar#setNavigationContentDescription() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CartActivity.java From RetailStore with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.cart_act); ButterKnife.bind(this); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow_flipped, GravityCompat.END); registerHideableHeaderView(findViewById(R.id.headerbar)); mFragment = (CartFragment) getFragmentManager().findFragmentById(R.id.product_request_frag); // Add the back button to the toolbar. Toolbar toolbar = getActionBarToolbar(); toolbar.setNavigationIcon(R.drawable.ic_up); toolbar.setNavigationContentDescription(R.string.close_and_go_back); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { navigateUpOrBack(CartActivity.this, null); } }); }
Example 2
Source File: ProductActivity.java From RetailStore with Apache License 2.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.product_act); ButterKnife.bind(this); // registerListener(); categoryId = getIntent().getIntExtra(SELECTED_CATEGORY_ID, 0); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow_flipped, GravityCompat.END); registerHideableHeaderView(headerbar); mFragment = (ProductFragment) getFragmentManager().findFragmentById(R.id.product_request_frag); // Add the back button to the toolbar. Toolbar toolbar = getActionBarToolbar(); toolbar.setNavigationIcon(R.drawable.ic_up); toolbar.setNavigationContentDescription(R.string.close_and_go_back); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { // unregisterListener(); navigateUpOrBack(ProductActivity.this, null); } }); }
Example 3
Source File: ToolBarUtil.java From Android-Architecture with Apache License 2.0 | 3 votes |
/** * 设置Toolbar左边按钮 * * @param toolbar * @param resId * @param descId * @param listener */ public static void setToolbarNavigation(Toolbar toolbar, int resId, int descId, View.OnClickListener listener) { if (toolbar == null) return; toolbar.setNavigationIcon(resId); toolbar.setNavigationContentDescription(descId); toolbar.setNavigationOnClickListener(listener); }