Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android ICS left caret resource

Tags:

android

The new Android design docs mention use of an Up caret: http://developer.android.com/design/patterns/actionbar.html

The up caret seems to be proper for navigation throughout Android - is there a proper way to add this caret? It seems unintuitive that I should just modify the icon image to include it.

Any help would be much appreciated!

like image 692
munchybunch Avatar asked Nov 28 '25 16:11

munchybunch


1 Answers

You can also add the caret by setting setDisplayHomeAsUpEnabled(true) on the ActionBar. Be sure to react to the menu item when selected.

@Override
protected void onCreate(Bundle savedInstanceState) 
{
    super.onCreate(savedInstanceState);

    ActionBar actionBar = getActionBar();
    actionBar.setDisplayHomeAsUpEnabled(true);
    actionBar.setDisplayShowTitleEnabled(true);
}

@Override
public boolean onOptionsItemSelected(MenuItem item) 
{
    switch( item.getItemId() ) {
        case android.R.id.home:
            Log.d(TAG, "Home Icon Item Selected");
            return true;
        default:
            return super.onOptionsItemSelected(item);
    }
}
like image 53
ThanksMister Avatar answered Nov 30 '25 05:11

ThanksMister



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!