menuitem

Android MenuItem Custom Layout

本小妞迷上赌 提交于 2019-11-26 21:13:26
问题 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=

How can I dynamically create menu items?

删除回忆录丶 提交于 2019-11-26 19:50:28
I'm building an Android application and I'm trying to build a user management system where users can login, logout, etc. I want to display a login menu item if the user is logged out and a logout button if the user is logged in. How can I do this dynamically? This is the layout file right now: <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@+id/add" android:title="Add" android:icon="@drawable/ic_menu_add"/> <item android:id="@+id/list" android:title="List" android:icon="@drawable/ic_menu_list"/> <item android:id="@+id

Custom view for Menu Item

不打扰是莪最后的温柔 提交于 2019-11-26 18:18:38
问题 I need to have dynamic Menu Item, a circle of user defined color, like this: touching this menu item will open a color picker. Now, I have sample ColorPickerIcon which extends View public class ColorPickerIcon extends View { private Paint mPaint; private int mColor; private final int mRadius = 20; public ColorPickerIcon(Context context) { super(context); mColor = Color.BLACK; mPaint = createPaint(); } public ColorPickerIcon(Context context, AttributeSet attrs) { super(context, attrs); mColor

Android: How to enable/disable option menu item on button click?

ぃ、小莉子 提交于 2019-11-26 17:26:32
问题 I can easily do it when I am using onCreateOptionsMenu or onOptionsItemSelected methods. But I have a button somewhere in screen, and on clicking that button, it should enable/disable context menu items. 回答1: Anyway, the documentation covers all the things. Changing menu items at runtime Once the activity is created, the onCreateOptionsMenu() method is called only once, as described above. The system keeps and re-uses the Menu you define in this method until your activity is destroyed. If you

Android: How to enable/disable option menu item on button click?

≯℡__Kan透↙ 提交于 2019-11-26 17:11:45
I can easily do it when I am using onCreateOptionsMenu or onOptionsItemSelected methods. But I have a button somewhere in screen, and on clicking that button, it should enable/disable context menu items. Vikas Anyway, the documentation covers all the things. Changing menu items at runtime Once the activity is created, the onCreateOptionsMenu() method is called only once, as described above. The system keeps and re-uses the Menu you define in this method until your activity is destroyed. If you want to change the Options Menu any time after it's first created, you must override the

System.Windows.Controls.MenuItem without icon area

荒凉一梦 提交于 2019-11-26 16:54:45
问题 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. 回答1: 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

Sql Server 'Saving changes is not permitted' error ► Prevent saving changes that require table re-creation

◇◆丶佛笑我妖孽 提交于 2019-11-26 16:46:06
When I create a table in SQL Server and save it, if I try to edit the table design, like change a column type from int to real, I get this error: Saving changes is not permitted. The change you have made requires the following table to be dropped and re-created. You have either made changes to a table that can't be recreated or enabled the option prevent saving changes that require the table to be re-created. Why do I have to re-create the table? I just want to change a data type from smallint to real . The table is empty, and I didn't use it until now. Robert Harvey From Save (Not Permitted)

JavaFX 2.0 Activating a Menu like a MenuItem

陌路散爱 提交于 2019-11-26 16:37:33
问题 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

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

不羁岁月 提交于 2019-11-26 16:31:29
问题 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="

android: changing option menu items programmatically

帅比萌擦擦* 提交于 2019-11-26 15:25:37
问题 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? 回答1: 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