0

同じアクティビティにタブ バーとカスタム タイトル バーがあります。静的モードでは、タブ バーとカスタム タイトル バーを同じアクティビティに表示できます。しかし、動的な値をカスタムのタイトルバー属性に割り当てると、次のようにエラーが表示されます

AndroidRuntimeException: カスタム タイトルを他のタイトル機能と組み合わせることはできません 提案があれば教えてください。

前もって感謝します

4

1 に答える 1

0

試す:

this.getActionBar().setDisplayShowCustomEnabled(true);
this.getActionBar().setDisplayShowTitleEnabled(false);
this.getActionBar().setDisplayUseLogoEnabled(true);

final LayoutInflater inflator = (LayoutInflater)this.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        final View v = inflator.inflate(R.layout.header_bar, null);

        //if you need to customize anything else about the text, do it here.
        //I'm using a custom TextView with a custom font in my layout xml so all I need to do is set title
        ((TextView)v.findViewById(R.id.header_bar_title)).setText(this.getTitle());
        //assign the view to the actionbar
        this.getActionBar().setCustomView(v);

setContentView()メソッドの前にこれを行うようにしてください。

于 2012-06-14T11:02:33.177 に答える