bvitaliyg
bvitaliyg

Reputation: 3255

Set custom home layout in ActionBarSherlock

How to set a custom layout instead home layout? The layout defines via XML. I tried so, but the app crashes.

<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="MyStyle" parent="Theme.Sherlock.Light.DarkActionBar">
    <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
    <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
</style>

<style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
    <item name="homeLayout">@layout/custom_home</item>
    <item name="android:homeLayout">@layout/custom_home</item>
</style>

Upvotes: 2

Views: 675

Answers (1)

Tomik
Tomik

Reputation: 23977

You can't change home layout. Although android:homeLayout item is exposed via the API you can't touch it without causing a crash. Even if you set it to @null value it will not change.

I think it is present in the API by mistake. Because internally the layout is always casted to HomeView which is a private layout extending FrameLayout.

Do not ever change android:homeLayout! If you want to have different home layout, hide it and create custom view instead.

Upvotes: 2

Related Questions