尝试显示操作栏向上指示器时,它会在图标旁边显示为白色空白方块。我有一个动作栏的自定义主题。我试图将背景设置为绿色,然后将图标与向上箭头设置
我的Styles.xml中的
<style name="Theme.Base" parent="@android:style/Theme.Holo">
<item name="android:background">@color/white</item>
<item name="android:windowBackground">@color/white</item>
<item name="android:actionBarStyle">@style/Theme.Base.ActionBar</item>
<style name="Theme.Base.ActionBar" parent="@android:style/Widget.Holo.ActionBar">
<item name="android:homeAsUpIndicator">@color/blue</item>
<item name="android:background">@color/green</item>
<item name="android:icon">@drawable/icon</item>
在我班级的顶部,我设置了主题
[Activity(Label = "My Activity", Theme = "@style/Theme.Base", NoHistory = true)]
public class Login : Activity
在我的活动中
#region ActionBar MENU
/// <summary>
/// Creating the menu
/// </summary>
/// <param name="menu">the menu to create</param>
/// <returns>boolean</returns>
public override bool OnCreateOptionsMenu(IMenu menu)
{
var inflater = MenuInflater;
inflater.Inflate(Resource.Menu.MapItems, menu);
ActionBar.SetDisplayShowHomeEnabled(true);
ActionBar.SetDisplayHomeAsUpEnabled(true);
ActionBar.SetHomeButtonEnabled(true);
ActionBar.SetDisplayShowTitleEnabled(false);
//Hide menu items you dont require
menu.FindItem(Resource.Id.MyAccount).SetVisible(false);
return base.OnCreateOptionsMenu(menu);
}
/// <summary>
/// On Menu Item Click
/// </summary>
/// <param name="featureId">The feature Id</param>
/// <param name="item">The item selected</param>
/// <returns>boolean</returns>
public override bool OnMenuItemSelected(int featureId, IMenuItem item)
{
switch (item.ItemId)
{
case (Constants.Home):
StartNewActivity(typeof(Map.Map));
break;
}
return base.OnMenuItemSelected(featureId, item);
}
#endregion
答案 0 :(得分:0)
我无法改变颜色,但白色方格现在消失了。删除背景设置为白色有助于:-)并设置父主题
parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<style name="Theme.Base" parent="@android:style/Theme.Holo">
<item name="android:windowBackground">@color/white</item>
<item name="android:actionBarStyle">@style/Theme.Base.ActionBar</item>
<style name="Theme.Base.ActionBar" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
<item name="android:homeAsUpIndicator">@color/blue</item>
<item name="android:background">@color/green</item>
<item name="android:titleTextStyle">@style/Theme.Base.ActionBar.TitleTextStyle</item>