menuitem

How to use Actionbar items with Viewpager + Fragments

早过忘川 提交于 2019-12-03 12:47:02
Im trying to figure out how to implement Actionbar items based on the Fragment that is being loaded inside my viewpager. My code is below and im just trying to figure out the best practice for working with ABS + ViewPager + Fragments. MainActivity public class MainActivity extends SherlockFragmentActivity { private ViewPager mPager; private TitlePageIndicator mIndicator; private MainPagerAdapter mAdapter; private List<Fragment> mFragments; private static final String FRAGMENT1 = Fragment1.class.getName(); private static final String FRAGMENT2 = Fragment2.class.getName(); private static final

How to correctly bind a ViewModel (which Include Separators) to WPF's Menu?

谁都会走 提交于 2019-12-03 09:38:28
问题 I'm using MVVM and I want to data bind my list of MenuViewModels to my maim menu. Which consists of a set of menu items and separators. Here's my MenuItemViewModel code: public interface IMenuItemViewModel { } [DebuggerDisplay("---")] public class SeparatorViewModel : IMenuItemViewModel { } [DebuggerDisplay("{Header}, Children={Children.Count}")] public class MenuItemViewModel : IMenuItemViewModel, INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; public

WPF: Disappearing icons

∥☆過路亽.° 提交于 2019-12-03 07:12:43
I have several icons which are declared in Window.Resources. They show up fine the first time they need to appear (eg: a Menu is clicked, the MenuItem icon works), but after another Menu (eg: a context menu) is shown, the original icon disappears and does not return. It's as though the last element which used the icon for the first time gets to keep it. <Window.Resources> <Image x:Key="Chart_16" Source="pack://application:,,,/Resources/images/chart_16.png" /> ... <Window.Resources> <MenuItem Header="Summary" Command="loc:AppCommands.ShowSummary" Icon="{StaticResource Chart_16}" /> I've tried

What should I pass for root when inflating a layout to use for a MenuItem's ActionView?

北城余情 提交于 2019-12-03 06:30:28
问题 I have an ImageView that I attach to a MenuItem as its ActionView (the item appears in the ActionBar ). The layout for this view comes from XML. I'm inflating it like so: ImageView actionView = (ImageView) layoutInflater.inflate( R.layout.action_view_layout, null); This appears to work fine. However; passing null for root in the call to inflate() makes Lint yell at me: Avoid passing null as the view root (need to resolve layout parameters on the inflated layout's root element) I can seemingly

Set a menu item as checked from code

巧了我就是萌 提交于 2019-12-03 05:54:55
问题 I have an Android application with the following menu item in one of the Activities (which concerns handling a list of names and mac numbers): <item android:id="@+id/menu_sort_tagg" android:icon="@android:drawable/ic_menu_sort_by_size" android:title="@string/menu_sort_list" > <menu> <group android:checkableBehavior="single"> <item android:id="@+id/sort_by_name" android:title="@string/sort_by_name" /> <item android:id="@+id/sort_by_mac" android:title="@string/sort_by_mac" /> </menu> </item>

How to change the position of menu items on actionbar

╄→гoц情女王★ 提交于 2019-12-03 05:29:40
I'm developing one application in which I have to add a custom layout on actionbar. Adding the custom layout is done, but when I'm adding the menu items on actionbar my custom layout changes it's position from right of the actionbar to center of the actionbar. Below is the image what I have achieved so far. I want something like this on the actionbar. Custom layout(yellow button) at the right most part of actionbar and menu items in the middle. Adding my code to achieve this custom layout using native android actionbar: @Override protected void onCreate(Bundle savedInstanceState) { super

How to set icon color of MenuItem?

只愿长相守 提交于 2019-12-03 04:30:32
问题 I defined a menu item that has ShareActionProvider and share white icon like so : <item android:icon="@drawable/ic_share_white_24dp" android:id="@+id/action_share" android:title="@string/action_share" android:orderInCategory="200" app:showAsAction="ifRoom" app:actionProviderClass="android.support.v7.widget.ShareActionProvider"/> But when I launch the application, I get a different black share icon. How to set the share icon to be white? Here is the result that I have 回答1: This is a theming

Android Change Navigation Drawer Menu Items Text programmatically

自古美人都是妖i 提交于 2019-12-03 04:14:00
问题 I have the new Navigation Drawer in my app and I want to change the navigation view menu items title text dynamically from code. I have watched many posts but I can't figure out, how can I do this. How can I achieve this correctly? MainActivity.java @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton

How to correctly bind a ViewModel (which Include Separators) to WPF's Menu?

不羁岁月 提交于 2019-12-03 01:26:38
I'm using MVVM and I want to data bind my list of MenuViewModels to my maim menu. Which consists of a set of menu items and separators. Here's my MenuItemViewModel code: public interface IMenuItemViewModel { } [DebuggerDisplay("---")] public class SeparatorViewModel : IMenuItemViewModel { } [DebuggerDisplay("{Header}, Children={Children.Count}")] public class MenuItemViewModel : IMenuItemViewModel, INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; public MenuItemViewModel(string header, ICommand command, ImageSource imageSource) { Header = header; Command =

Disabled menu items in Winforms still show subitems

流过昼夜 提交于 2019-12-02 21:37:04
问题 If I create a menu with two items (say "Item1" and "Item2" and then create two subitems under each one (1A, 1B, 2A and 2B), and then disable Item1, I'd expect that 1A and 1B wouldn't show. And, indeed, if I move onto Item1 they don't. Unless I then move on to Item2, wait for 2A and 2B to show, and then move back to Item1. At which point 1A and 1B both pop up, fully active. Is this a known bug? Is it something I can work around? Any suggestions? The users want to be able to see the things that