menuitem

Android MenuItem Custom Layout

拟墨画扇 提交于 2019-11-27 22:53:09
I have a PopupMenu that appears when I click on an action button in a actionbar. I would like the MenuItem, in my PopupMenu, with a custom layout like this: layout/menu_item_layout.xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/menuItemLayout" android:orientation="horizontal" > <ImageView android:id="@+id/imageViewMenuItem" android:layout_width="20dip" android:layout_height="20dip" android:src="@drawable/abc_list_focused_holo" /> <TextView android:id="@+id/textViewMenuItem"

MenuItem's checked state is not shown correctly by its icon

给你一囗甜甜゛ 提交于 2019-11-27 20:39:57
I have MenuItem defined this way: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/menu_starred" android:icon="@drawable/btn_star" android:title="@string/description_star" android:checkable="true" android:checked="true" android:orderInCategory="1" android:showAsAction="always" /> </menu> and btn_star.xml defined this way: <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_checked="false" android:drawable="@drawable/btn_star_off_normal" /> <item android:state_checked="true"

How to change Custom Font of Android Menu Item?

蓝咒 提交于 2019-11-27 19:23:59
I have the following Android Java and XML code. I want to change the font of Menu Items of my app. I know only that we can change the font of TextView using setTypeface but not able to find anyway for Menu Item. JAVA Code-: @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_refresh1: Toast.makeText(this, "Item1 Selected", Toast.LENGTH_SHORT) .show(); break; case R.id.action_refresh2:

Change Menu Items Programmatically From Eclipse Plugin

限于喜欢 提交于 2019-11-27 18:50:52
I would like to be able to completely remove menu items upon startup of my eclipse plugin application. What I want to do is be able to add these menu items later depending on business logic based off of the user's actions. Is there a way to do this? I've looked at using contributions, but I feel like it's not going to be exactly what I want. If it can do what I need it to do, how do I go about using them? Thanks in advance for any assistance. Rich Seller You can obtain the Menu from the MenuManager and then modify the contributions. This snippet shows how to access the menu manager and remove

WPF ContextMenu itemtemplate, menuitem inside menuitem

◇◆丶佛笑我妖孽 提交于 2019-11-27 18:25:31
问题 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

System.Windows.Controls.MenuItem without icon area

人盡茶涼 提交于 2019-11-27 14:42:36
Whenever I try to play with the look of WPF menu item, I get a wast opportunities to customize the header, which is basically the text of an item. What I need, is to have a black menu, with white text and no "icon area". ||Some text http://img848.imageshack.us/img848/7622/iconarea.png How can I remove the icon area of the menu item? Thanks. CodeNaked You would need to take the default Styles from here and remove that area from the MenuItem's control template. For MenuItem, you can actually just redefine the SubmenuItemTemplateKey and SubmenuHeaderTemplateKey ControlTemplate, something like

JavaFX 2.0 Activating a Menu like a MenuItem

筅森魡賤 提交于 2019-11-27 14:05:49
I'm making a MenuBar , and I wan't the functionality to press a Menu like: "File" and then execute a action. Such like opening an other fxml, or an example where some output is written. I want the functionality of a MenuItem (lie "About") in a Menu like "File". package model; import static java.lang.System.out; import javafx.application.Application; import javafx.beans.property.ReadOnlyDoubleProperty; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Pos; import javafx.geometry.Side; import javafx.scene.Group; import javafx.scene.Scene; import javafx

How to set foreground and background colors on a WPF Menu control?

雨燕双飞 提交于 2019-11-27 13:45:46
I've been working in WPF for quite a while, but there's something basic about styling that I just don't get. How can I set the foreground and background colors for a Menu control? I started with this: <Menu IsMainMenu="True" Background="#FF3A3A3A" Foreground="White"> <MenuItem Header="_File"> <MenuItem Header="_Exit"> </MenuItem> </MenuItem> </Menu> The foreground color is apparently inherited by the MenuItem , but the background is not. Next attempt: <Menu IsMainMenu="True" Background="#FF3A3A3A" Foreground="White"> <MenuItem Background="#FF3A3A3A" Header="_File"> <MenuItem Header="_Exit"> <

How to style menu button and menu items

倖福魔咒の 提交于 2019-11-27 13:38:06
I tried to change styles in menu button. I could change menu button style but not its menu item. No matter what i try menu item inside menu-button remains unchanged. .menu-button { -fx-background-color:black; } .menu-button .label { -fx-background-color:black; } Now how can i change color that is left out?? Uluk Biy MenuButton uses Menu internally and has a similar API. In such way that MenuButton contains MenuItem s list just like Menu . So I think you need to try to play with .menu , .menu-button and .menu-item CSS selectors in caspian.css. More specifically with .menu-item . EDIT: It seems

android: changing option menu items programmatically

社会主义新天地 提交于 2019-11-27 11:04:20
Is it possible to change the option menu items programmatically? Can anyone provide me with an example please? Also, I want to disable certain items, so that they don't listen to the clicks, is it possible? For anyone needs to change the options of the menu dynamically: private Menu menu; // ... @Override public boolean onCreateOptionsMenu(Menu menu) { this.menu = menu; getMenuInflater().inflate(R.menu.options, menu); return true; } // ... private void hideOption(int id) { MenuItem item = menu.findItem(id); item.setVisible(false); } private void showOption(int id) { MenuItem item = menu