Skip to content
프로젝트

소개

Android implementation of font-based icons.

디자인 및 미디어

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

FontIcon Library

Build Status

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

Links

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

    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

res/xml/ic_android.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

res/layout/f_glowing.xml

    <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.

관련 프로젝트 살펴보기

불러오는 중…