While I was Looking for HTML render engine for Android, I found CSSBOX, but unfortunately it uses java awt which is not available in Android.
Anybody knows a fork of CSSBOX or something else than can render simple HTML to Android, preferably into Android views?
Android WebView is limited and I can't access "each" rendered word, I need this to set bookmarks using exact offset of word in original HTML file.
Related
I have developed an application which contains a WebView for loading additional URL contents, but I have an issue.
The issue is that when I load a local language URL, some devices don't support local languages special characters, so some empty squares are shown.
How can I load an additional font in my application or device?
Custom fonts are not that easy in android. You will need some .ttf files, which You must load at runtime as typeface.
This link has nice information, also about best practices, on how to deal with custom fonts properly.
Check out:
Android - Using Custom Font
If your webview is showing an online page (as opposed to a html file which is compiled into the assets somewhere, like Cordova/phonegap does), you perhaps should look at using a web font in the css. The easiest thing to do is uses google have a few hosted, see:
https://developers.google.com/fonts/docs/getting_started#Quick_Start
http://www.google.com/fonts (is the full list of fonts)
Hope that helps. (other webfont options are available).
I have an iOS App localized (with Localizable.strings files).
I've built now an Android version. I understand the way the i18n is made on android but I would like to avoid redoing the i18n, as almost all the Strings have the same meaning between iOS and Android.
Are there any tools that will do this conversion, or at least speed up the process?
Edit:
Ideally I would like to find a method/tool that would do the following
Input:
'iOS Localizable.strings files-(en,fr,it,pt,etc)'
'res/values/strings.xml'
Output:
'res/values-en/strings.xml'
'res/values-fr/strings.xml'
'res/values-it/strings.xml'
'res/values-pt/strings.xml'
'res/values-etc/strings.xml'
There is a specialised service here: Loco.
There are threads here on SO which deal with conversation:
Are there any tools to convert an Iphone localized string file to a string resources file that can be used in Android?
Any tool to convert Android's XML localization to iPhone's .strings file?
Another possiblity would be to use an online translation service. These services accepts text not only in Android and iPhone but also in many other formats. Upload the android text and download the iPhone text. A list of available services can be found on SO, see Any collaborative tool/website to localize an Android app? Some of these services are commercial, but even these provide a 30days test period. But note that the main focus is on translation and not on conversation.
Here is some code that does that: https://github.com/wrapp/LocalizedStrings2Android
Put it in a jar and it is ready to use.
You can use this tool I created on JSFiddle:
https://jsfiddle.net/danielgindi/x9njj9gj/
[StackOverflow requires me to write some code here because of the JSFiddle link]
Just paste in your localization strings inside the correct box, and you'll get the converted version in the other boxes (Between Android, iOS, and JS).
This tries to preserve comments too.
Cheers!
I've developped an application using XML Eclipse tool too build my UI.
Now, i'd like to use a tool like Axure to create a "nicer" interface.
My problem is : is there an easy way to switch from XML to HTML (because Axure is producting HTML file from Wireframe design) ?
And if not, how to "plug" HTML file to the existing application (which is using R.layout.xxx or R.id.xxx to access displayed elements).
I'm quite new in Android by the way...
thanks !
You can't really do what you describe. The way Android layout is specified in XML cannot be compared at all to HTML for websites. Besides, Axure is a mock-up tool. It creates interactive mockups and prototypes - not final solutions for anything.
If you really want to use Axure, perhaps you would want to go for web apps with something like PhoneGap - they are written in HTML and JavaScript, but have less possibilities.
I have a flash animation file converted into HTML5 file using SWIFFY. These files are being played in WebView, they play fine.
There are few animations in HTML5, I would like to control these little animations in Android locally on the touch event. I want to know as to how to expose these animations to the Android layer, is there anything else required like Javascript or JQuery?
I would like to add, that I am totally new to HTML5, CSS, JavaScript and JQuery.
Any help would be greatly appreciated.
If I understand the problem, you can't do it like that because the animations defined within the swiffyobject become parts of one larger svg, which the swiffy runtime then manages. The runtime itself exposes just a small API, which is a bit constraining. I've found no way to say "my swiffy.someAnimationWithin.doSomething()"
What you can do is use stage.setFlashVars to pass "messages" to your ActionScript, which of course was also translated and is being played by the runtime. In this ActionScript, use onEnterFrame to check for those variables/messages then change their states with ActionScript. The animation can also talk back to your JavaScript via ActionScript's getURL("javascript: mynamespaceObj.doSomethingScripty()") or, I believe, AS3's URLRequest(...)
Is their any possibility to use XHTML design for android application instead of XML design
XHTML is a specific vocabulary for web pages; XML is a grammar for representing data. Both are standards from http://w3.org/
XHTML is a document markup language, like HTML. (Except, HTML is defined in the SGML grammar, and XHTML limits itself to the XML subset of that grammar.)
XML is a grammar (of sorts; this is a simplification) to define various data and document markup types.
Neither are, per se, used to develop applications; however, the Android SDK has several "small languages" that it uses that are defined in terms of XML for things like the manifest file and user interface layouts. These can not be substituted for another language, even one that looks similar on the surface, like XHTML.
It's roughly analogous to: Both English and French use fairly similar punctuation and the same alphabet, just as all XML dialects have similar notation, but even though they may look the same, it does not mean that one can substitute French for English at will.
You may see reference to "applications built using XHTML" or "...HTML;" typically, in fact, these are applications which produce HTML (or XHTML) output, or interact with/modify existing HTML/XHTML documents. The applications themselves are written in JavaScript if they run in the web browser; or some other language (Perl, PHP, Ruby, Python, Lisp, C++, even JavaScript again) if they run on the web server.
You could always use a WebView and render HTML inside of that, but you'd be much better off just learning Android's XML, or using the drag-and-drop Interface Builder in the Eclipse Plugin, which is actually pretty good since it was revamped earlier this year.
As far as I'm aware, you'd have to use the XML format to create an acutal layout within Android (and then use code within Android to control the interface). However, a good alternative would be to use the WebView class, which allows you to display a webpage within your application. This would likely writing a small amount of XML layout to display that view, but from there you can just make your "app" a webpage and control it however you best see fit (server-side processing if you have it on the actual "web" or perhaps JavaScript).
This may not be the only option, but it should work well.
Read more about WebViews here: http://developer.android.com/guide/webapps/index.html
I suppose you could, although you'd have to define an xslt transform that will translate the xhtml into android's xml language. You'd probably be confined to a small subset of xhtml, though.
XHTML is just one application of XML. XHTML is in fact XML. To answer your second question, yes you must use XML everywhere the documentation tells you you must. Sometimes you can do things programatically - but its probably easier to do it in XML, especially if you use the right tools.