Domanda

Like a lot of people, I would like to use a custom title bar in android but also use the Holo theme. I've seen a lot of posts recommending using Theme.Holo.NoActionBar but it still gives me the same error as when I change my custom theme to use Theme.Holo. I want to resolve once and for all, is it possible to use a custom title bar like this:

requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.activity_main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE,R.layout.custom_title_bar);

which seems to be the most common way to do it.

È stato utile?

Soluzione

Well you can create another element layout which looks like title bar for you and in the current activity you can set requestWindowFeature(Window.FEATURE_NO_TITLE)

This way you get the holo theme aswell as custom title. This is commonly used practice in this scenario.

Altri suggerimenti

you can define parent="@android:style/Theme.Holo" then just disable the windows action bar

like this

<item name="android:windowActionBar">false</item>

in theme.

It's working for me...

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top