How to make app icon as up enabled in actionbarsherlock (not the title only icon) like in whats app.
Displaying ActionBar IconsetDisplayShowHomeEnabled(true); getSupportActionBar(). setLogo(R. mipmap. ic_launcher); getSupportActionBar().
Android ActionBar is a menu bar that runs across the top of the activity screen in android. Android ActionBar can contain menu items which become visible when the user clicks the “menu” button.
The title is clickable together with the icon since Android 4.2.2. WhatsApp uses a custom view to display a two line title. This disables the title click along the way. You can do it the same way:
ActionBar actionBar = getSupportActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setDisplayShowTitleEnabled(false);
actionBar.setDisplayShowCustomEnabled(true);
actionBar.setCustomView(R.layout.ab_title);
TextView title = (TextView) findViewById(android.R.id.text1);
title.setText("Title");
/res/layout/ab_title.xml:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
style="@style/TextAppearance.Sherlock.Widget.ActionBar.Title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:ellipsize="end"
android:gravity="center_vertical" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With