Is it possible to add my language(ladakhi) support in android because I don't see my language in android system by default so I wanted to add it manually. The way I am trying to do was by adding custom font (.tff) in my app and add to the android system.
But I am quite not sure whether it is possible or not ? If so please share me a resource or link where I can look up to.
[Expected Result]
Just like how we change android system language to hindi, kannada etc.I wanted to add my language support in android system.
Regards
A similar question is asked here. The answer is you can't unless you download the android source and add a new language translation. For more you can #Romain Guy answer here
Currently I'm using the Calligraphy library to use custom fonts, it's awesome https://github.com/chrisjenx/Calligraphy
But i can't preview the new fonts, is there any way to preview the custom fonts in Android Studio?
In order to view the Custom fonts you have to run the code and check in the mobile.
**Note :**ALL Fonts may not be accurate in emulator,Better to run in mobile for best experiance.
Currently I'm using the pixlui library to use custom fonts, and it's great!
https://github.com/neopixl/PixlUI
Is there any way to preview the custom fonts in Android Studio?
I have created a Library called Smart Fonts for Android. It allows you to preview the custom fonts in the Layout Editor of Android Studio.
The fonts are cached in memory so that they are loaded once.
Smart Fonts is easy to integrate with gradle, it is documented and available on GitHub:
https://github.com/smart-fun/SmartFonts
enjoy!
Unfortunately no. The way that PixelUI is setting the font doesn't work in the previewer.
They are only setting font in one constructor as is visible here:
https://github.com/neopixl/PixlUI/blob/master/Library/src/com/neopixl/pixlui/components/textview/TextView.java
The constructor the editor is using is the second one, and the font is not set when the TextView is constructed this way.
I like the look and feel of the Spinner in Android ICS. I support a minimum of android 2.1 so i want the Spinner to have an ICS look on the Android 2.1. Is this possible.
Kind Regards,
Yes this is possible. You can make a custom style for your Spinner and set the drawable to the spinner style of ICS. You can find the 9-patch drawables here:
EDIT: project was moved:
https://github.com/Prototik/HoloEverywhere/tree/master/library/res/drawable-mdpi
You can do this with Android Support Library.
Download any support library and include in your project build path.
Does Android support SVG? any example?
The most complete answer is this:
The Android 2.x default browser does not natively support SVG.
The Android 3+ default browsers DO support SVG.
To add SVG support to 2.x versions of the platform, you have two basic choices:
Install a more capable browser (like Firefox or Opera Mobile - both support SVG)
Use a JavaScript polyfill that can parse SVG and render it to an HTML5 canvas
The first option is okay if you're just trying to make SVG work for personal uses or a limited (controllable) set of users. It's not a great option if you want to use SVG while targeting a large, uncontrolled user base.
In the later case, you want to use a polyfill. There are many JavaScript libraries available today that can prase SVG and render to a canvas. Two examples are:
canvg
fabric.js
Using a polyfill, you can render your SVG in a canavs on all versions of Android 2.x.
For a more complete example of this approach, you can refer to this blog post that discusses the use of the canvg polyfill for making Kendo UI DataViz charts (SVG-based) work on Android 2.x. Hope that helps!
There is a new open-source library that supports loading and drawing SVG Basic 1.1 files: https://github.com/pents90/svg-android. Performance is good as the actual drawing is handled natively by an android.graphics.Picture object.
There is a new library (under active development) androidsvg which allows one to incorporate svg images directly in to projects. It has the advantage of defining an SVGImageView which allows one to incorporate an svg directly in the layout xml.
Finally, including svg in android is straightforward.
More details: Stack Overflow post
Android supports vector drawables: https://developer.android.com/reference/android/graphics/drawable/VectorDrawable.html
And there exists an Android SVG to VectorDrawable Converter:
http://inloop.github.io/svg2android/
I know my solution is somewhat hardcore, but it works great, doesn't require any external libraries (at least not in your final code) and is extremely fast.
1) Just take an existing SVG loading library, such as for example svg-android-2 (which is a fork of svg-android mentioned in another answer, just with more features and bugfixes): https://code.google.com/p/svg-android-2/
2) Write a simple app that will do nothing else but load and display your SVG image.
3) Modify the SVG loading library, so that it prints the Java code that creates the Picture class or saves it in a String variable.
4) Copy-paste the Java code obtained this way into the app you are writing.
To get more information about this technique and download sample source code, go to my blog:
http://androiddreamrevised.blogspot.it/2014/06/transforming-svg-images-into-android.html
You can get a working example of this technique from Google Play here:
https://play.google.com/store/apps/details?id=pl.bartoszwesolowski.svgtodrawablesample
Here's an example of a commercial app created using this technique (Milan metro map):
https://play.google.com/store/apps/details?id=pl.bartoszwesolowski.atmmetroplan
Notice how fast the map loads and how pretty it looks, even when magnified.
Firefox for Android supports SVG.
Opera Mobile for Android supports svg, and Opera Mini supports static svg content.