I have a rectangle button and I am trying to align text in it like so for example:
but1.getLabel().setAlignment(Align.left);
I know that there are different options such as Align.right, bottomRight etc. However, all these options align the text around the edges of the rectangle like below. In this case bottomLeft and bottomRight:
I am looking for a way to specify something in between. For instance, I would like to align the text to be between bottomLeft and the center (not on the edges? For example:
A TextButton is essentially just a table with a Label component. This means that you can apply padding to it. If you want the label to be offset from the bottom left corner, just give the appropriate padding. This would look something like this:
TextButton tb = new TextButton("1", skin);
tb.pad(20, 5, 0, 15);
Of course, you can always add alignments or other paddings if necessary, but this is how you would manipulate the label's position.
Related
I am trying to display text inside series of spans. Like this:
Text length inside spans can vary.
What I want is to have span shape like oblong, like having semicircles at both ends.
I have tried using borderRadius, but not sure if it would work with span length varying.
How can I achieve it?
I am using an XML editor called Madcap Flare that allows me to create image maps using a GUI. Since that makes the maps easily editable, I would rather use that technique. Unfortunately, the code it renders is not a CSS image map, but an HTML one (map, area, etc.). I do not want to switch to a CSS image map, because I want to do easy editing in the GUI.
I want my image map to align right with text to the left of it. I have tried the following techniques with the indicated results:
Technique 1: I floated the div containing the image right with CSS.
Result: The image map no longer works, but the image floats right and the text wraps.
Technique 2: I floated the image right with CSS.
Result: The image floats right, but the div remains on the left. The text does not wrap and the image map no longer works.
Technique 3: I set the div align="right" and removed the CSS completely.
Result: The image floats right and the image map works, but the text no longer wraps.
I've noticed the image map only breaks when I float the image or its container; I even floated left to experiment and saw the same results. Is there no way to float an image map? I wondered if the issue were an image resizing issue, but I inspected the code and the image map is no inheriting any image size styles. I also set the image to max-width and max-height 100% in my tests to make sure it wasn't shrinking at all, but I saw the same results again. I also think that the HTML align=right experiment indicated that the problem was not an inherited style.
Any tips/tricks? Or any confirmation that you cannot float an image map? Thanks.
If the div containing the image map has a fixed size and is at the upper border of its parent DIV, you could do the following:
Create an empty DIV with the same size as the one containing the image map and make that float right (at the top). No border, no background, no contents. The text will float around that one.
Apply position: relative to the parent DIV and position: absolute to the div containing the image map. Apply top: 0;, right: 0 and the width and height as the empty floated DIV.
This places the image map above the empty floated DIV and the text floats around it.
How does one set the spacing between an imageUp and text in ImageTextButton.Style? The default positioning looks like this
, but I would like to move the image more to the left while keeping text centered. Is such thing possible in libgdx?
found one approach
imageTextButton.getImageCell().pad(//set padding);
or
imageTextButton.getLabelCell().pad(//set padding);
I am trying to create a table for printing purpose.
As seen in many forms, I want vertically rotated text and both left and right side of the form.
So far I have achieved this
Fiddle: http://jsfiddle.net/naveen/P8AZD/
This has two problems
I wanted the border td widths as 50 px with the text spanning more area. Currently the rotated text also gets clipped to 50px. How to overcome this?
The style rotate-right has incorrect filter: progid:DXImageTransform.Microsoft.Matrix. It has been copied from .rotate-left. What does the values (M11, M12, M21, M22) in the filter denote?
What is wrong with my code?
See http://jsfiddle.net/P8AZD/7/
I added a div around your text and made it not wrap
Essentially what I want to achieve is a a dynamic portion of text - in the middle of a paragraph, that is dynamic. I am having trouble creating an in-line div (or span) that can contain something like an unordered list or several other spans which I can move up or down to show them. Think a window (with overflow) that contains 4 divs stacked on top of each other, with only enough room to show one of them (the rest are hidden). I want to be able to move this stack up and down to show other parts of this stack.
I was hoping someone could reply with a jsfiddle that shows a big block of text with a dynamic portion in the middle of it, in line with the rest of the text in the paragraph.
You could start with something like this, using jQuery Draggable.
http://jsfiddle.net/RqHFL/
Apply the "draggable" to you div like this:
$( "#draggable1" ).draggable({ axis: "y" }); //constrained to y axis movement
After some consideration, vertical-align: bottom seemed to be my best friend.