Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/monkeymars/fonticon

Android implementation of font-based icons.
https://github.com/monkeymars/fonticon

Last synced: 3 months ago
JSON representation

Android implementation of font-based icons.

Awesome Lists containing this project

README

        

FontIcon Library
====

[![Build Status](https://travis-ci.org/shamanland/fonticon.svg?branch=master)](https://travis-ci.org/shamanland/fonticon)

FontIcon is simple library which use font-based icons in Android.

Links
----

- [Project page][8]
- [Example video][2]
- [JavaDoc][1]

Get demo on Google Play
----


Get it on Google Play

Pros and cons
----

**Advantages**

- Single ``.ttf`` file instead of lot of bitmaps for different densities (mdpi, hdpi, xhdpi, etc.)
- Scalable vector graphics instead of raster images
- Possibility to use any color for icon in run-time
- Possibility to use any graphics effect which is available for TextView

**Disadvantages**

- Not easy to add additional icons

Gradle dependency
----

```groovy
dependencies {
compile 'com.shamanland:fonticon:0.1.9'
}
```

Usage
----

**1. Create your font with icons**

Do it yourself. Check tutorial on [fontastic.me][4] service or find other service.

**2. Prepare your font to be used in Android.**

Read this [manual][5] for details. In case of fontastic use [this util][3].

**3. Declare your FontIconDrawable in xml**

[**res/xml/ic_android.xml**][6]

```xml


```

**4. Inflate your FontIconDrawable in Java**

```java
Drawable icon = FontIconDrawable.inflate(getResources(), R.xml.ic_android);
```

**5. Use your FontIconDrawable as compound for TextView, EditText or Button (in res/layout with custom class)**

```xml


```

**6. Use your FontIconDrawable as compound for TextView (in Java-code with platform class)**

```java
Drawable icon = FontIconDrawable.inflate(getResources(), R.xml.ic_android);
TextView tv = (TextView) result.findViewById(R.id.my_textview_or_button);
tv.setCompoundDrawables(icon, null, null, null);
```

**7. Use FontIconView as single icon in your layout**

```xml

```

**8. Add glowing effect on touch for your FontIconView**

[**res/layout/f_glowing.xml**][7]

```xml

```

Tools
----

[FontIcon-Prepare][3] - prepares web fonts to be used with this library

License
--------

Copyright 2014 ShamanLand.Com

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

[1]: http://shamanland.github.io/fonticon
[2]: https://docs.google.com/file/d/0Bwh0SNLPmjQBbXJVd3c3S2hfVTg/preview
[3]: http://github.com/shamanland/fonticon-prepare/
[4]: http://fontastic.me/howto
[5]: http://blog.shamanland.com/2013/11/how-to-use-icon-fonts-in-android.html
[6]: http://github.com/shamanland/fonticon/blob/dev/app/src/main/res/xml/ic_android.xml
[7]: http://github.com/shamanland/fonticon/blob/dev/app/src/main/res/layout/f_glowing.xml
[8]: http://blog.shamanland.com/p/android-fonticon-library.html