menuitem

How to change programmatically background color of action bar items

走远了吗. 提交于 2019-12-01 04:01:35
It is easy to set a default color of the items background in action bar by setting: <item name="android:actionBarItemBackground">@drawable/action_bar_item_background</item> in application theme. I would like to change this color only for one of my fragments. How to do it programmatically? Elementary Have you tried the solution from user3225831 mentioned here: https://stackoverflow.com/a/21297231/1738838 ActionBar bar = getActionBar(); bar.setBackgroundDrawable(new ColorDrawable("COLOR")); Use simple one line code... Pass RGB values of the required color getActionBar().setBackgroundDrawable(new

Android menu item background

我们两清 提交于 2019-12-01 01:28:38
I want to change the menu item background beacuse I use black icons, but on some phones the default color of background is black or other dark color. I tried this solution and it's worked but there was a little problen with it: I have ten items and that's why I have a "More" item to show other options, but if I choose the More item (which is got the custom background) and after that I press back button, the item will be in the default state, default colors. What is the solution? Thanks! The style attribute for the menu background is android:panelFullBackground . It's not hackish like the other

Android menu item background

孤街醉人 提交于 2019-11-30 20:46:15
问题 I want to change the menu item background beacuse I use black icons, but on some phones the default color of background is black or other dark color. I tried this solution and it's worked but there was a little problen with it: I have ten items and that's why I have a "More" item to show other options, but if I choose the More item (which is got the custom background) and after that I press back button, the item will be in the default state, default colors. What is the solution? Thanks! 回答1:

WPF - MenuItem missing Icon/Image

不想你离开。 提交于 2019-11-30 20:32:39
Im getting menuItem icon appearing only on last menuItem. If i snoop the app only last menuItem has image in icon, while if i debug all MenuItems appear to have image in icon. Also if i add submenuItem the icon on menuItem dissapears once i open submenus and the last submenu gets the icon... Any idea? PS: also tooltips on menu item dont work. Im using caliburn micro and fluent ribbon controls. <ControlTemplate x:Key="dropDownButton"> <ef:DropDownButton Header="{Binding DisplayName}" ItemsSource="{Binding Items}" LargeIcon="{Binding LargeIconPath}" cm:Message.Attach="ClickAction()" ef:KeyTip

Android: Custom view for a menu item

百般思念 提交于 2019-11-30 18:46:04
I want to be able to specify a custom view for a MenuItem . I want to display an indicator on a shopping cart menu item in the action bar displaying how many items are in the cart currently. Is the only way that I can do this is through adding a custom view instead of utilising the MenuItem lifecycle etc.? To use a custom view on a MenuItem call setActionView(View view) . You can supply either an already inflated view or a layout resource ID. 来源: https://stackoverflow.com/questions/17332584/android-custom-view-for-a-menu-item

Gmail tablet like Actionbar items

为君一笑 提交于 2019-11-30 17:56:19
I'm trying to build an app with a split actionbar/toolbar like in the Gmail app. Is there any view element for this behaviour or do I have to write such a toolbar myself? The search icon is moving with the master fragment when opening the slidingDrawer . To accomplish this you can add one of the new Toolbar widgets to each of your fragments layouts. The new Toolbar class was designed to be much more flexible than a traditional Actionbar and will work well in this split design. This post is a good overview for implementing a standalone Toolbar. For posterity's sake I've included the sample code

Android custom option menu item

喜欢而已 提交于 2019-11-30 17:50:16
问题 everyone! I have question for Android guys. Any help or suggestion will be appreciated. So my problem: I have application with ActionBarCompat and in this action bar I have a lot of different hiden menu items, which appear only if user click on menu button at action bar. Also I have couple menu items at action bar, which always visible. I need some customization for one of visible menu item. When user click on this menu item (let's say it would be "Add new" menu item), I need to show

Android: Custom view for a menu item

[亡魂溺海] 提交于 2019-11-30 16:53:54
问题 I want to be able to specify a custom view for a MenuItem. I want to display an indicator on a shopping cart menu item in the action bar displaying how many items are in the cart currently. Is the only way that I can do this is through adding a custom view instead of utilising the MenuItem lifecycle etc.? 回答1: To use a custom view on a MenuItem call setActionView(View view). You can supply either an already inflated view or a layout resource ID. 来源: https://stackoverflow.com/questions

WPF ContextMenu itemtemplate, menuitem inside menuitem

可紊 提交于 2019-11-30 14:23:39
I have the following xaml: <ContextMenu ItemsSource="{Binding TestItems}"> <ContextMenu.ItemTemplate> <DataTemplate DataType="models:TestItemModel"> <MenuItem IsChecked="{Binding IsSelected}" Header="{Binding Header}" /> </DataTemplate> </ContextMenu.ItemTemplate> </ContextMenu> The TestItemModel class only consists of a IsSelected boolean property and a Header string property. TestItems is a list of TestItemModels. The data is binded to the contextmenu but it is reflected in the UI as a MenuItem inside a MenuItem (with the additional margins as such, making the menu very big). I can fix this

How can I set the visibility of an ActionBar item in different fragment

ⅰ亾dé卋堺 提交于 2019-11-30 13:54:25
I'm looking for a way to set the visibility of a MenuItem inflated in my MainActivity depending on which Fragment I am on. For information: I'm using actionBarSherlock , zxing , and some google services . The application was built with a Navigation drawer(With abs), also I manipulate the FragmentStack in such way I everytime I switch to another Fragment when I press the touch back I come back in my Main Fragment . Here my menu: <menu xmlns:android="http://schemas.android.com/apk/res/android" > <item android:id="@+id/button_generator" android:title="GENERER" android:icon="@drawable/ic_drawer"><