Fonticon
Android implementation of font-based icons.
Install / Use
/learn @shamanland/FonticonREADME
FontIcon Library
FontIcon is simple library which use font-based icons in Android.
Links
Get demo on Google Play
<a href="https://play.google.com/store/apps/details?id=com.shamanland.fonticon.example"> <img alt="Get it on Google Play" src="https://drive.google.com/uc?id=0Bwh0SNLPmjQBY096eE9PMmlKVEk" width="204" height="60"/> </a>Pros and cons
Advantages
- Single
.ttffile 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
dependencies {
compile 'com.shamanland:fonticon:0.1.9'
}
Usage
1. Create your font with icons
Do it yourself. Check tutorial on fontastic.me service or find other service.
2. Prepare your font to be used in Android.
Read this manual for details. In case of fontastic use this util.
3. Declare your FontIconDrawable in xml
<?xml version="1.0" encoding="utf-8"?>
<font-icon
xmlns:android="http://schemas.android.com/apk/res-auto"
android:text="@string/ic_android"
android:textSize="@dimen/big_icon_size"
android:textColor="@color/green_170"
/>
4. Inflate your FontIconDrawable in 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)
<com.shamanland.fonticon.FontIconTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Dummy text"
app:iconLeft="@xml/ic_android"
/>
<com.shamanland.fonticon.FontIconEditText
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Dummy text"
app:iconLeft="@xml/ic_android"
/>
<com.shamanland.fonticon.FontIconButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Dummy text"
app:iconLeft="@xml/ic_button_yes"
/>
6. Use your FontIconDrawable as compound for TextView (in Java-code with platform class)
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
<com.shamanland.fonticon.FontIconView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/ic_android"
android:textSize="@dimen/icon_size"
android:textColor="@color/icon_color"
/>
8. Add glowing effect on touch for your FontIconView
<com.shamanland.fonticon.FontIconView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/icon_glow_radius"
android:text="@string/ic_googleplus"
android:textSize="@dimen/big_icon_size"
android:textColor="@color/pressed_googleplus"
android:clickable="true"
app:overridePressed="true"
app:pressedGlowColor="@color/googleplus"
app:pressedGlowRadius="@dimen/icon_glow_radius"
/>
Tools
FontIcon-Prepare - 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.
Related Skills
node-connect
345.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
104.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
