I'm generating HTML-mails and as such, need to fall back to inline styling.
As a result, it's not possible (or hard?) to use #font-face and I need to rely on font-style or font-family.
It's working alright, but using "Impact" (required), is a problem since I can't find an Android replacement. Is there one? Is there a list of the fonts that the gmail app can render?
Related
I have made a website using HTML5.
However, I'm trying to make the app using the CSS, JavaScript and HTML I used for the website. Is that somehow possible?
I must use Android Studio.
Nope, you can't do that.
Android Studio is based on Java (logic) and XML (design).
XML and CSS are a little bit similar. You have paddings and margins too.
However. Prepare yourself to put work into the project.
But why do you need an app when you can also show the same contents in a website that works on way more devices? You can also use a WebView to show your website in the app.
If it must be native and you can't use a WebView, just rebuilt the design, Check out the material design guidelines, stick to them and your app will be easy to use for the users and look awesome.
Links:
https://material.google.com/ (read through the components stuff)
https://design.google.com/icons/ (all icons)
I'm developing an app that needs to support multiple languages, including some for which fonts are not included in some older Android versions.
The same TextView can have content in multiple languages, so setting a single TypeFace does not help, I need to have a list of fall-back fonts to use when some characters are not available in preferred fonts.
Extending to this, I also need to use the same set of fonts for other elements also (not only TextViews) if possible.
I had a workaround for this. I extended the Application class for the app and set the fonts globally there.
For the fallback fonts, I read the Android API code for Typeface and going from there, I found some hidden APIs. Doing all sorts of hacking (reflections, getting private/hidden classes or methods, setting private fields etc.), I finally made it working for Android API versions 21 to 23. Not sure about the newer APIs and it doesn't work for the older ones.
You can check my code at https://gist.github.com/nisargjhaveri/47acc83e66dcb347e05685ccfd3038e8
It is working, but even I don't recommend using it!
The better solution for this may be to use TypefaceSpans, after detecting the best typeface for each character, everytime you show text to user. I did not try this.
Also, I just have been playing with android for past two months, so think twice before you take my advice! :P
I'm trying to use Android's material icons in a View from within my app. I can't seem to find an example anywhere of how to reference them. I can't imagine, for this standard set of icons, that I'm required to copy and paste them into my actual app under the res directory. Surely there must be a simpler way since 90% of Android apps are using the same drawables! What I'm looking for is something like:
<TextView
...
android:drawableLeft="???" />
Is it possible to do this and reference the drawable from some package that I import? Or do I actually have to copy all the icons I want to use into my application resources? That seems completely unnecessary to me.
The developer guide says they're named */drawable-{{density}}/ic_{{name}}_{{color}}_{{size}}dp.png but it's precisely the * which I would like to know (and I hope it's not myapp/res/drawable!).
You can try Android Material Design Icon Generator plugin for Android Studio, If you are using Android Studio. Link to the plugin development Git repo is here
It is Easy and convenient. You can go through the image set and get the name from the google material design official website and then, you search for it and you can add that one to your project without any hassel.
Yes, you have to copy all your icons to your res folder. It's been said by Google somewhere. The "Material Icons" website clearly is oriented towards that and it makes it easier. One important reason to do this is that you'll want the icons to work not only in Lollipop, but also in previous Android versions.
Actually i want to design my app through css and html and want to code that css generated elements throgh android code.
Like suppose i have created a button in css.Can i use my android native language to code that button?
Officialy, java is the development language for android. So, if we are being really strict, you should use whatever tools java and the android sdk give you to create and style your elements (you can read about it here). But of course, there's always more than one way of doing stuff, and thanks to the Adobe overlords, you might just have what you are asking for.
Phonegap is a highly powerful opensource framework that allows you to code you entire app using HTML, CSS and JavaScript. Once you are done coding, phonegap does its magic and generates the app for you, so you don't need to touch a single line of java code.
So, basically, I don't think there's a way of using CSS in pure native android code (if there is, please feel free to share). But if you really want to use it, Phonegap is the way to go (I've used it before, it's cool)
Is there a way to embed a customized webkit engine in an app to add a WebView with SVG support ?
The according Bug Entry mentions some android core dependencies which seem not-so-easy to replace, not sure if all of that could be included in a built to provide exactly a webkit webview with your app.
However, in general one can use another library project to be referenced and included on compilation. And then there is a way to include other JAR files, a way to convert an existing project into a library as well as even a way to butcher an .apk and get the code out (which again you can turn into a libary).
Never done it, but in theory, get a library, .jar or .apk of the browser you want to bundle (as mentioned the beginning seems not the best candidate), look into the original code what is done to instantiate that browsers view in an activity - and off you go.
Would love to hear when you or anybody else has accomplished to do such a thing, i couldn't wait to see if we could bundle it with multitouch enabled (another big drawback in 2.x) for multitouch on the android stock browser on 2.x devices i started a polyfill project out of desparation (which works surprisingly well, but is also way simpler than emulating a complete SVG interpreter), so for matter of SVG and providing the best browser runtime for the job, this would be great.
P.S. There is one completely different workaround depending on what you want to do with SVG. If it's just some small stuff to fill on the screen at times you might check google for "svg polyfill" which leads to a myriad of solutions - i couldn't recommend one straightaway, as those implementations are so different that you should evaluate them with your actual app.