My question is how can I modify this code (the selected method):
https://github.com/dudeofawesome/CardboardHome/blob/master/app/src/main/java/dudeofawesome/cardboardhome/Launcher.java#L721
so the text (name of the app like in the photo and icons) are rotated
Thanks a lot!
Try the method Canvas.drawTextOnPath, with a path that goes along the line you want but from right to left, instead of left to right, which would draw the text as you have it already. The picture doesn't show any rotation, so it's unclear what you want your end result to look like.
Or try this.
Disclaimer: I only used it once to make curved text by specifying two paths, separate for the top and bottom. It may also be more of what you want:
Related
I have a map image in my java project when the user clicks on two cities I want to draw a line on the map image between these two cities, so if I do any effects like zooming the lines get affected too not just the image. how can I do that, any help would be appreciated.
so if I do any effects like zooming the lines get affected too not just the image.
Put the map image and the line in the same Parent (e.g. Group, Pane, etc). Then apply the zoom to the Parent Node, and not the map image directly.
I have text in the screen. I want my program to find the text on the screen, and tell me the absolute coordinates on the screen. The text on the screen is not part of my java program.
How might one do this?
You can use Robot.createScreenCapture() to take a screenshot.
But to actually read and find the text you need some OCR software or implement your own implementation in Java. You don't know how the text is displayed, which font, which size, which color, ClearType .... That's the tricky part.
I am writing text from right to left.
how can i add an image at the end of the text (alligned nicely)?
The question isn't entirely clear.
The order of objects added to a Document is always respected, except in the case of Image objects. If an Image object doesn't fit the page, it can be forwarded to the next page, and other content can be added first. If you want to avoid this, use writer.setStrictImageSequence(true);
However: you're writing from Right to Left (probably in Hebrew), so the above doesn't apply, not the previous answer by Anshu. You can only use RTL in ColumnText and PdfPTable.
It's not clear what you want to do.
Do you want to add an Image at the bottom of the text? That's easy: just add the text first, then add the Image. Do you want to add an Image inline? In that case, you can wrap the Image in a Chunk as is done in this example: http://itextpdf.com/examples/iia.php?id=54
My interpretation is: you want to add the image at the bottom left, and you want the text to be added next to the image. That's more difficult to achieve. You'd need to add the Image and the text separately. Add the Image at an absolute position and add the text using 'irregular columns'. That is: ColumnText in text mode (as opposed to composite mode). For an example showing how to use irregular columns, see http://itextpdf.com/examples/iia.php?id=67
I have two views called x and y they are both black lines (for example I made the height of the x line is 1dp and width 230dp and as background filled with the color black).
Now i want to move the position of the lines programmatically (for example I want the y line 50dp to the right of the orginal position).
Can someone help me how to do this?
I have tried things such as setpadding but the line doesn't move.
Thanks in advance!
(ps: my minimum sdk is set for 7 so i can't use the newest api's).
Old Answer
Have a look at the Absolute Layout, it allows you to position
child elements using x, y coordinates. It is deprecated but it's the
only way in Android to do real x,y coordinate positioning.
I would ask what the main point behind what you are trying to do is
though? It sounds like you started with a goal, were led down a path
and now are asking how to get to the end of that path, rather than
asking how to do what you need to do.
Edited
For drawing graphs have a look instead at https://stackoverflow.com/questions/2271248/how-to-draw-charts-in-android.
Using a Layout class to draw a chart will only lead to a really slow app, since the layout classes are designed for creating relatively static layouts, not drawing full graphics.
Instead use either the Canvas and draw your drawables yourself or use the graphing packages listed in the SO question I linked above.
Can anyone tell me why the black borders are appearing in the emulator, and how to remove them?
Add black lines along the upper edge and the left edge, it could be that the device does not accept it as a valid nine-patch if you are missing black on any of the sides.
This could be related to ninepatches that have 'gaps' in the black lines appear to work in the editor, but will not work on a device.
Edit:
And as #ByteMe states in a comment, make sure you have the .9.png at the end of the filename.
When I had this problem it was because I forgot to rename the images!! This shouldn't be an issue if you use the tools provided by Google to make draw9... but it'w worth double checking!
image should be named *.9.png