窗框改变颜色 [英] Change color of window frame
问题描述
我如何去改变这个对话框的框架的颜色?我已经尝试了一堆东西,并没有什么作品。
< XML版本=1.0编码=UTF-8&GT?;
<资源>
<样式名称=CustomDialogTheme父=@安卓风格/ Theme.Dialog>
<项目名称=机器人:windowNoTitle>真< /项目>
< /风格>
< /资源>
您的意思是白框?我认为这是9补丁的一部分绘制的,你可以看一下Theme.Dialog是如何建立的SDK_FOLDER \平台\ Android的sdkversion \ DATA \水库\值 然后styles.xml和的themes.xml
正如我所说的,白框的背景图像的一部分。其panel_background.9.png所以,如果你想改变框架 - 你需要不同的背景图片+需要在风格上要覆盖其设置
<项目名称=机器人:windowBackground> @android:绘制/ panel_background< /项目>
和你需要定义将从Theme.Dialog派生的风格,有这个
<项目名称=机器人:windowBackground> @可绘制/ your_drawable< /项目>
所以,如果你把styles.xml像
<样式名称=NewBorderDialogTheme父=机器人:Theme.Dialog>
<项目名称=机器人:windowBackground> @可绘制/ your_drawable< /项目>
< /风格>
提出了新的绘制,并设置你的活动,以新的主题 - 你应该看到您的新的边界
How do I go about changing the color of the frame of this dialog? I've tried a bunch of things and nothing works.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="CustomDialogTheme" parent="@android:style/Theme.Dialog">
<item name="android:windowNoTitle">true</item>
</style>
</resources>
You mean white frame ? I think it's a part of 9-patch drawable you can look up how Theme.Dialog is build in the SDK_FOLDER\platforms\android-sdkversion\data\res\values and then styles.xml and themes.xml
As i've said, the white frame is a part of the background image. its panel_background.9.png So if you want to change frame - you'll need different background image + need to overwrite in style setting it.
<item name="android:windowBackground">@android:drawable/panel_background</item>
and you'll need to define a style that will be derived from Theme.Dialog and have this
<item name="android:windowBackground">@drawable/your_drawable</item>
so if you put in styles.xml something like
<style name="NewBorderDialogTheme" parent="android:Theme.Dialog">
<item name="android:windowBackground">@drawable/your_drawable</item>
</style>
Put new drawable and set your activity to the new theme - you should see your new border
这篇关于窗框改变颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!