只需简单介绍一下Java中windowsTitle的更改背景

只需简单介绍一下Java中windowsTitle的更改背景,java,android,Java,Android,我不想做一件简单的事情,我的背景的windowTitle必须在我的应用程序中更改。但是我怎样才能访问我背景的windowTitle呢 My style.xml: <resources> <style name="CustomWindowTitleBackground"> <item name="android:background">@drawable/fond</item> </style> <style name="

我不想做一件简单的事情,我的背景的windowTitle必须在我的应用程序中更改。但是我怎样才能访问我背景的windowTitle呢

My style.xml:

<resources>
<style name="CustomWindowTitleBackground">
    <item name="android:background">@drawable/fond</item>
</style>

<style name="CustomTheme" parent="android:Theme.Light">
    <item name="android:windowTitleSize">40dip</item>
    <item name="android:windowTitleBackgroundStyle">@style/CustomWindowTitleBackground</item>
</style>
</resources>
我怎样才能做到这一点?

试着用这个

((TextView)((FrameLayout)((LinearLayout)((ViewGroup) activity.getWindow().getDecorView()).getChildAt(0)).getChildAt(0)).getChildAt(0)).setBackgroundResource(R.drawable.back);

您只需使用窗口标题布局的ID即可。就像你会做的正常布局。
我假设您的窗口标题布局中有类似于线性布局的内容。只需使用它的id获取它并将背景设置为可绘制。

我尝试了以下方法:RelativeLayout rl=RelativeLayout findViewByIdR.id.relativeLayoutWindowTitle;rl.setBackgroundResourceR.drawable.found_doc;
((TextView)((FrameLayout)((LinearLayout)((ViewGroup) activity.getWindow().getDecorView()).getChildAt(0)).getChildAt(0)).getChildAt(0)).setBackgroundResource(R.drawable.back);