Anchor text is lost center align when is add in menu item - vaadin

I'm working with Vaadin 14.4.0 and a newbie on this framework. I have a layout with center align and contain compoment menubar like this
HorizontalLayout layout = new HorizontalLayout();
layout.setAlignItems(FlexComponent.Alignment.CENTER);
MenuBar menuBar = new MenuBar();
MenuItem menuItem = menuBar.addItem("Menu");
SubMenu subMenu = menuItem.getSubMenu();
subMenu.addItem("Item 1");
subMenu.addItem("Item 2");
subMenu.addItem(new Anchor("https://example.com","ABC"));
layout.add(menuBar);
All items (item 1, item2) are aligned with center style except item ABC is aligned with left style.
How can I set item ABC aligned center style like other items( item1, item2)? Or Do you have any solution for that?

A screenshot would help to see the issue more clearly.
Here’s what I get in a Vaadin 23 project:
Menu Bar items (in the submenus) should be left-aligned by default. How are you centering them? The FlexComponent.Alignment.CENTER does not make that happen. At least in the above screenshot, it might look like Item 1 and Item 2 are centered, but they are left aligned.
I’m guessing you might have some custom CSS that aligns the item texts, but that CSS is not targeting anchor elements inside the menu.
Menu Bar uses Context Menu internally, so you need to style context menu items. Here’s what should work, placed in your application global styles:
vaadin-context-menu-item {
text-align: center;
}

Related

How to adjust the position of tab bar item iOS?

I want to create a custom tabBar like this
Now I just can create a tabBar as below, I want the 4 tab bar Items (the add sign is a button) to be centered and don't cover the button, so the cart icon should move to the left a little bit, and the mall icon should move to the right. But I don't know how to adjust the position of tab bar item, neither using storyBoard or in a programmatic way.
Thank you for your help.
You should try adjusting the insets for the individual icons. You can do this in the storyboard.
Check this post:
Moving UITabBarItem Image down?
Please modify Item Position in Attributes Inspector in Storyboard.
Select Item position as "Centered".
Choose Custom for Width and Spacing.
Play with the numbers for Width and Spacing and set it was you wish.

Moving highcharts export menu button to a different div

Is is possible to move the highcharts hamburger menu into another div? I wanted to place this menu button in either a header or a footer to the displayed chart and not have it show in the chart area. I tried playing around with the css and set the :
navigation: {
buttonOptions: {
symbolX: 23,
symbolY: -22
}
}
so i can push the menu button to the area of the header but it seemed that the icon disappeared either behind the header div or just doesn't show once it leave the chart display area.
Anyone have any input on this matter?

Bar button item icon size and width

I have a navigation bar with 3 bar button items. But i wonder why i have a huge space between first two icons ? And why default share icon less then my custom icons. My custom icons have size 29x29.
Update: for navigation bar, you simply need to place all three items in one of the two (Left Bar Button Items) or the (Right Bar Button Items) as follows:
and it should look like this:
As for tool bar items:
What you need to do is put a flexible space bar button between your buttons like so:
then it will look like this:

Pin Horizontal Spacing Between Two UIImage Views in Xcode 7

I am a beginner using Xcode 7 beta, working off a tutorial that uses Xcode 6. In the tutorial, the instructor selects Editor, Pin, and Horizontal Spacing to pin the space between two images so that it stays the same when switching to landscape. In Xcode 7, the Editor menu doesn't include a Pin menu. Does anyone know how to pin horizontal spacing between two images in the new Xcode 7?
This is close to what you need
You can choose View (current distance = 0) from the drop down menu
Use the pin button at the bottom right corner of the storyboard view. It looks like a Tie-fighter icon.
You will also notice that Pinning two elements to each other for horizontal and vertical spacing is not there. Instead select the left item and add a right constraint. Then select the right one and add a left constraint. You will see the horizontal spacing indicator appearing between the two. YMMV.
EDIT
If you are going thru the same tutorial (RW) as I am going thru, fear not! The control-drag between elements still works the same and brings the options XCode 6 shows in a similar way (ex: ctrl-drag from left to right way brings a popup menu with horizontal spacing.) I hope this helps.
Just to kind of clear this (good) answer up - select the left image, then the "pin" icon (tie fighter looking thing), click the right constraint icon at the top that looks like this:
|--|
...leave the value of it where it is. Then click the "add constraints" button. Do the same for the right image. Then run the app and verify that it works.

How to achieve uneven spacing between the items in tab bar?

In my application I want to set the tab bar items at uneven positions inside the UITabbar (meaning the space between 1st and 2nd is not equal to the 2nd and 3rd and so on)
I know there is no such options as the item don't have a frame property. so is that possible to achieve this by some other ways like
self.tabBarController.tabBar addSubview:buttonItem
Or is it Possible to reposition the items in the desired location inside tab bar?
In your storyboard, you can drag and drop a "Fixed/Flexible space bar button item" into your toolbar. This will serve as a separator between buttons. Also, Drag and drop an outlet connection to the controller if you want to control its width programmatically. You can also adjust the spacing through the inspector (look for the width property). For example if your Fixed space bar button item's outlet name is spacer, you can set the width of the spacer as follows:
self.spacer.width = 50; (or whatever value)
Hope this helps.

Resources