开发者

Just a simple thing about windowsTitle change background in Java

i wan't to do a simple thing, my background's windowTitle must change in my application. But how i can access to my background's windowTitle ?

My style.xml :

<resources>
<style name="CustomWindowTitleBackgr开发者_如何转开发ound">
    <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>

And in my Activity :

super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.page_doc);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title);

How i can do this ?


You can just use the ids of the window_title layout. Just like you would do with normal layout. I assume that you have something like a LinearLayout in your window_title layout. Just use the id of it to get it and set the background Drawable.


try to use this

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜