Android:如何使用xml样式更改弹出窗口的标题栏颜色

时间:2018-03-21 15:20:32

标签: android xamarin

我有以下样式表,但弹出标题仍为白色。如何使用xml样式更改此内容?

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="Theme.Splash" parent="android:Theme">
        <item name="android:windowBackground">@drawable/splash</item>
        <item name="android:windowNoTitle">true</item>
    </style>

    <style name="YellowWarning" parent="android:Theme">
        <item name="android:textColor">@color/yellow</item>
    </style>

    <style name="FloodSearchTheme" parent="@android:style/Theme.Holo.Light">
        <item name="android:actionBarStyle">@style/FloodSearchTheme.ActionBarStyle</item>
        <item name="android:textColor">#ffffff</item>
        <item name="android:editTextStyle">@style/FloodSearchTheme.EditTextStyle</item>
        <item name="android:itemBackground">#333333</item>
    </style>

    <style name="FloodSearchTheme.ActionBarStyle" parent="@android:style/Widget.Holo.Light.ActionBar">
        <item name="android:titleTextStyle">@style/FloodSearchTheme.ActionBar.TitleTextStyle</item>
        <item name="android:background">#333333</item>
    </style>

    <style name="FloodSearchTheme.ActionBar.TitleTextStyle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
        <item name="android:textColor">#ffffff</item>
    </style>

    <style name="FloodSearchTheme.EditTextStyle" parent="@android:style/Widget.EditText">
        <item name="android:background">#ffffff</item>
        <item name="android:textColor">#000000</item>
        <item name="android:padding">10dp</item>
    </style>
</resources>

enter image description here

这是代码......

    public override void OnCreateContextMenu(IContextMenu menu, View v, IContextMenuContextMenuInfo menuInfo)
    {
        base.OnCreateContextMenu(menu, v, menuInfo);
        if (v.Id != Resource.Id.historyListView) return;

        menu.SetHeaderTitle("Options");  commenting this out bc i can't figure out how to make the title bar white, doesnt seem to be a style associated and google searches have turned up nothing
        menu.Add("Edit");
        menu.Add("Delete");
        menu.Add("Share via Email");
        menu.Add("Share via Text");
        menu.Add("Get Full Report");
    }

1 个答案:

答案 0 :(得分:0)

您是否尝试过设置android:windowTitleStyle? Here是一个类似的问题