문제

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.

도움이 되었습니까?

해결책

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.

다른 팁

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...

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top