I'm porting application from iPad to Galaxy Tab and, since I hadn't had much experience with programming for Android devices I'd like to know some "general" things.
I've used CoreText for all my ipad text drawing needs, what can I use in Android? How can I break large text apart dividing it in to frames/paths and then layout them on screen (think, columns in news application articles). It looks like that Paint class does some things related to what I need, but I don't know if that's the proper way to go.
Please, enlighten me :)
The Layout object is what you are looking for, in particular its subclass StaticLayout. It's what's used by TextView to shape the text and render it on screen. It's basically a smart wrapper around the various methods offered by Paint to measure and draw text.
Personally I would wait for Honeycomb, maybe Gingerbread if you're lucky. Currently Android is not optimized for tablets, plain and simple (can you imagine developing on the iPad with just the standard iPhone SDK?)
Gingerbread is going to be announced before the new year and we might get some tablet goodies, but Honeycomb (release soonish?) is when full tablet support will be available.
For the timebeing maybe develop for the standard phone size, but keep it modular enough so the upgrade for tablets is painless.
Related
So i was building this UI for an app in Unity to be deployed on Android Platform.
Here is the preview from the Game Window :
But when i build and run the app on my device, it shows this :
The header log is anchored on Top, the title is anchored on Center and the buttons are anchored on Bottom.
Here is the hierarchy of the components :
Im new to Unity and NGUI so i really dont know what's wrong with this. Thank you guys.
Different behavior is probably caused by different resolution/ration on your device in compare to your editor window. To emulate such behavior in the unity editor, you can force resolution/ration in your game window, or you can add your specific device resolution (what I actually recommend for you to do as a good start):
When you experiment with few of them, you will see that your interface is behaving in different ways.
To change that behavior on different screens, you can check your UIRoot options, especially Scaling, see UIRoot documentation.
Another good places to start is NGUI forum's topic concerned in handling different resolutions or official video about NGUI anchors.
Hope that this will guide you to perfect cross-device interface design.
I think your problem is configuring how is going to work NGUI with your sprites. There are 2 things you could do:
Use a pixel perfect resolution: This will maintain the perfect size of the sprite, and will look the same on every platform (this causes some things to look smaller if the resolution is higher)
Use a fixed Size of the UI and recalculate the sized based on the device.
The problem you are having here.. is because of that. The background for example, should be larger if the screen is larger.
To achieve that.. NGUI provides you with a UIRoot where you can configure the Scaling style to PixelPerfect, FixedSize and FixedSizeOnMobiles.
Try setting that up and the images will adapt to the different sizes.
Hope this works for you, I'll attach an image so you can check out what I'm talking about
I am working with AndEngine and OpenGL ES 2.0. I keep reading about GL_MAX_TEXTURE_SIZE and how I should keep my texures under 1024x1024. I started wrong before and while using tilesets in TMX extension (doesn't really matter what it is, if you don't know AndEngine) I get to a tileset that makes a texture wider than 1024px. I am thinking of splitting the tileset into two, making them "safe". But I can't find any device released in last couple of years that has this limit set under 2048x2048. Is there any list or website I can use to filter devices by GL_MAX_TEXTURE_SIZE?
I read the following questions:
Minimum required Texture Size for compliance with OpenGL-ES 2.0 on Android?
Is there any Android device with screen size greater than GL_MAX_TEXTURE_SIZE?
And I used this site to search for devices. But I can't search by/filter by GL_MAX_TEXTURE_SIZE, which makes the search tedious. I am asking mostly because I started wrong, it's a hobby project and the amount of work might be too large compared to the number of possible devices that will be enabled (I expect 0).
1024x1024 is about the safest you can go on any device, especially on older ones. Newer devices shouldn't have any problem, although I've seen recent devices (I recall a Galaxy Nexus, the newest ICS update fixed that though) render white quads with texture sizes of size 2048x1024.
If you're targeting new devices and want to keep older ones compatible, it shouldn't hurt to split your tilesets. After all, you aren't likely to do too many context switches if you use two or three spritesheets for background, etc.
If you still have the individual image files, breaking them into small sized Atlases or custom sized atlases is easy if you use the TexturePacker2 tool from the LibGdx library.
I don't know the exact limitation of devices, but it's always better to take into consideration the lowest end of device you want to support and build upward from there. Using the LibGdx tool, you can easily change your mind later, so it's the most flexible solution.
Look at:
LibGdx TexturePacker
I have been learning android development and I am still new to this.
I have already designed many apps for iOS.
Is there a better way to have my layouts as easy as iOS?
because in iOS I only have to drag and move it wherever I want . Where in android I have to insert tables and edit XMLs, which I find very confusing and not flexible to deal with.
I have read and watched many tutorial and still find it a bit difficult to deal with
Thanks
There is a layout editor for Android that you can use in Eclipse. Is that what you're looking for?
http://developer.android.com/guide/developing/tools/adt.html#graphical-editor
The short answer is NO. The long answer is that this is how it's done on Android, and it's much more flexible than the iOS method. Just imagine making Android app the iOS way and support screen sizes such as 240x320, 320x480, 480x800, 480x854, 540x960, 600x1024, 720x1280...and so on, and it's easy to realize that it would be an impossible task. This is almost certainly why Apple went with "Retina Display" with exactly 2x the pixel density and exact same screen dimension (3.5") - because doing anything else would mean that all the apps would need to be designed specifically for the new screen instead of just providing images with a #2x postfix.
So, instead of absolute positioning and sizing like the iOS, XML is used in Android where designers are tasked to come up with one or more layouts that can support this diverse range of screen sizes.
You can use Eclipse Layout Editor for Drag and Drop with absolute layout. But using absolute layout is not a good practice because in iOS screen size is fixed for all device but in android there are different screen size device are available and if you design a layout considering a single screen size it will be messed on another screen size device. You must follow the norms to create a layout go through this link for more detail.
http://developer.android.com/guide/topics/ui/layout-objects.html
Let me explain our situation first,
We plan to develop a web application by using webview component which will work on tablet devices (target device specification: Android 3.0, Dual Core Processor (1GHz x 2), 10.1"WXGA, 1GB RAM).
In the application there will be 2D animations and we design a character. Like,
This character may wear different things, may change mimics
This character may walk with these artifacts (over a fix background image)
Application will use local resources.
My Questions are,
1) Which tools will be best to show these animations considering performance in webview and less resources size.
Canvas
SVG
Pure javascript by using fix images or animated gifs
Or something else? (Note: We do not want to use flash)
2) Which development environment(s), tool(s) do you suggest to construct these animations and related resources?
This is my first post in stackoverflow.
I hope this post and answers may help other developers also...
Best Regards,
Canvas would be better when we count in performance and SVG is something you can't render truly in all of the browsers, coz in previous versions of android SVG is not enabled by default you have to do a workaround on it to get it worked. Canvas is best tool as you can render it in most of the browsers and considering performance in webview. any how android 3.0 onwards ther's a support for SVG.
Are there any android zooming solutions that can be applied to a generic android view?
My app needs to push a lot of information onto the screen, and on some phones, screen is so small that this data becomes unreadable.
I want to get zooming functionality that works for textview's and image buttons in particular. I imagine a zoomView that works for these two built-in's would work for most of the others too.
I've looked around on the web and haven't found any easy solution yet. Most of the discussion seems to be focused on zooming images or a webview.
If there is not an existing solution, can anyone suggest a good approach to take?
Are there any android zooming solutions that can be applied to a generic android view?
That is not possible except perhaps on Android 3.0. On Android 3.0 (API Level 11), you have getScaleX() and getScaleY() which might suit your needs.
If there is not an existing solution, can anyone suggest a good approach to take?
Design a different UI optimized for smaller screens.
Or, use a ScrollView (or HorizontalScrollView) and use bigger widgets (effectively pre-zooming your content).
You can try to implement your own pseudo-zoom by changing the text size and button sizes based upon user input (e.g., options menus to zoom in/out), but I'm not sure how well that will work.