在preferenceActivity自定义标题栏? [英] Custom title bar in PreferenceActivity?

查看:153
本文介绍了在preferenceActivity自定义标题栏?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是自定义标题栏为我所有的活动,但我可以在preferenceActivity使用。 所有我可以在preferenceActivity做的是这样的:

I am using a custom title bar for my all activities but i can use this in PreferenceActivity. All i can do in PreferenceActivity is this:

    @Override
protected void onCreate(Bundle savedInstanceState) {
    requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
    getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_bar);
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.preferences3);

在preference活动我的标题栏留总是灰色的,没有任何文字,但其他活动的作品非常好这个code。我能做些什么来解决我的问题?

My title bar in preference activity stay always grey without any text but other activities works very well this code. What i can do to solve my problem??

推荐答案

getWindow()...... 后超和添加preferencesFromResource ... 所以顺序应该是:

put getWindow().... after super and addPreferencesFromResource... so order should be:

requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences3);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.title_bar);

P.S。下面的 @杰弗里 - blattman 三十万四千二百七十零分之一千一百九十三万五千五百九十六>我的previous答案这里 ..

p.s. credits to original author @jeffrey-blattman following my previous answer here..

这篇关于在preferenceActivity自定义标题栏?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆