I am trying to add up(homeup) button in actionbar. I have added parent activity option in manifest and it works if I don't use custom layout. My custom layout code is following.
actionbar = getSupportActionBar();
View view = getLayoutInflater().inflate(R.layout.top_header_layout, null);
ActionBar.LayoutParams params = new ActionBar.LayoutParams(ActionBar.LayoutParams.FILL_PARENT,ActionBar.LayoutParams.FILL_PARENT);
actionbar.setCustomView(view, params);
actionbar.setDisplayHomeAsUpEnabled(true);
actionbar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent">
<ImageView
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:src="@drawable/top_bar_logo"
/>
</FrameLayout>
<activity
android:name=".MoreDetailsActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:parentActivityName=".AccountInfoActivity"
android:label="@string/more_details">
<meta-data android:name="android.support.PARENT_ACTIVITY"
android:value=".AccountInfoActivity"/>
</activity>
Try replacing
actionbar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
with
actionbar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM | ActionBar.DISPLAY_SHOW_HOME);
Also use this actionBar.setIcon(your_drawable);
in order to display your back icon.