TextMeshPro Text Overlaps Icon - unity3d

I have my highscore, when it changes it moves to the left, but i need to move it to the right.
How i could achieve that?
Here is problem in imgur picture
I'm using canvas with TextMesPro Text and icon as image
TextMesPro

Put the text and the icon inside a HorizontalLayoutGroup and add a LayoutElement to both. Set the HorizontalLayoutGroup to control child height/width, child force expand width/height. Set the flexible width to the text (in the LayoutElement) to a very high value. Set the preferred size of the image to the size you want the icon to be. You might also want to add a little bit of spacing to the layout group.

Related

Unity: Button spacing differs at different screen resolutions

In my game (Unity 2017.3.1f1) I'm using a ScrollView that's filled with buttons at runtime.
At 1080p:
And at 1440p:
The blue dots show the constraints of the Content, the whole thing (including the grey part below) makes up the Scroll View. No matter how big/small I make the Content, the border doesn't vanish at 1440p but is instead resized with the Content.
The width of the ScrollView is set through a surrounding panel
The buttons all use the same pefab (Inspector: click) - 1st image below
The buttons are arranged by a Vertical Layout Group on the Content (Inspector: click) - 2nd image below
As you can see in the last screenshot, the Vertical Layout Group is set to force expand the button's width and control its size, which isn't set anywhere else. I also don't set any padding/spacing in the Vertical Layout Group and yet there's an empty space between the two buttons.
I want it to look the same at 1080p and 1440p. What am I missing?

Change the border's color of a button in Unity3D

I began to work with Unity3D since one month and I'm trying to do an application which contains a menu, composed by a panel and several buttons. At this moment, I'm trying to customize the menu, I change the fill color of the panel and buttons, but until now I could not change the border color of the buttons. There is any way to customize the border's color of the UI buttons? I would appreciate your help. :)
The easiest way to add an outline to your button is to use the Outline component (doc).
Simply add the Outline component where your button image or text is. Then configure it how you like it :)
The above results in the following button:
No, you can not change just border color. If you use default buttons, take a look at Source image. It is basically a grey square with black borders. So when you change color of image black color remains black.
To customize buttons as you want you need either create nested UI elements:
or create sprites with colors you want and replace source image
I find nested UI elements to be the easiest way to do something like this. Simple example:
Start out by creating a panel and change the scale until you get the desired size for your button. This will be your "borders".
Next create another panel as a child of the panel you just made and change the scale to be just slightly smaller than your first panel and change the color.
In the Inspector for your panel, add component and type in Button and add it as a component.
Finally, add a text as a child of your panel for a label and you're done.

Swift - Auto constraints

I am trying to use the auto size classes from the storyboard on xcode 7 to position UI elements in a controller. The problem that I'm running into is that when I try to use the "Add missing constraints" function (located at the bottom right corner of the console), it positions my UI elements correctly except for the last elements (pictures describe better). The first image below shows the storyboard file where I just want 3 buttons (stacked above eachother) to be the same width and length to be on the top right corner of any screen.
However, when I add constraints and run the simulations, it seems like the top two buttons are positioned correctly with the correct length and width but the third button is out of place (image below).
So my question is, am I forgetting a step to make all buttons position themselves? Or should I try to convert everything to a percentage and place UI elements based on the percentage of the screen (if so, how would I go about doing that)?
I've also tried adding another blank button (removing the button label) underneath the 3rd button and adding constraints like that but it didn't work for me. Let me know if you have any suggestions, thanks!
In you case, Autolayout the constraints you need to give to UIButton is 4 constrains.
Leading
Trailing
Width
Height
If you miss any of them, then surely you will get an error. So, what's your error is?
To the third UIButton, you have not given the height, while to the above two buttons you have given.
So, just remove the bottom constraint of UIButton and give the equal height to above UIButton.
FYI, never use Add Missing Constraints without any confirmation from your side.
Update:
Check this video to remove trailing or leading margin:
http://sendvid.com/1h8deg18
You can actually see the solution in action if you use the Preview screen while setting up your auto layout constraints. I just created a similar view and buttons and stepped through the process. I coloured the buttons and named them to make things obvious.
I added the three buttons. At this point, none of the buttons show up in the preview.
I then setup the auto layout constraints for Button1. If you want the buttons anchored to the top right, then you don't need to worry about the leading constraint. You need width, height, top, and trailing.
Now Button1 will snap to it's position in the top right corner of the preview screen.
Now do the same thing for Button2. Set width, height, top (vertical space to Button1), and trailing.
Button2 will now snap into place in the preview.
Now the same thing again for Button3. You anchored the first button to the top right of the screen. Then Button2 to the bottom of Button1 and the right edge of the screen. Then again for Button3. You could also align the edges of the 2nd and 3rd buttons, if you prefer that to trailing space.
Now you'll see in the preview that your buttons are correctly positioned, regardless of device.
As long as you specify height and width for each button, you don't need to worry about the left edge or the bottom edge of the screen at all. They each know to "stick" to the top right and they know what size to be.
** Note: If you're not familiar with the "Preview" option...
With your storyboard open, hold Option and select storyboard again to get another copy of the storyboard on the right side. Highlight the view controller you are interested in on the left side. On the right side, select the Preview option as shown below.
Now you have your storyboard and the preview side by side, so you can see the exact impact of any auto layout changes you make. You can also add or remove devices to the preview.

Dynamic Width Slides?

I'm using a JSSOR slider that scrolls content horizontally. My issue is that the slide content is dynamic. An admin has the ability to add and remove images & text from the slider, however not all the divs are the same width. This creates gaps and/or overlapping.
I can create a code to get the width of each slide prior to the initialization of jssor, however I'm wondering if there's a way to apply $SlideWidth to individual slides by index?
Thanks.

PictureScrollField in BlackBerry

I want to create a PictureScrollField using some images in Blackberry.By default it is displayed on the top of the screen with the given width and height.
But if we want to display the entire one at certain coordinates say(x,y),then how to align them.
add the picture scroll field in a horizontal field manager and align the manager