Android Font Loading Textview

Helper for using custom fonts in styles

Лицензия

Лицензия

Категории

Категории

Сеть
Группа

Группа

net.kianoni
Идентификатор

Идентификатор

fontloader
Последняя версия

Последняя версия

0.3.0
Дата

Дата

Тип

Тип

aar
Описание

Описание

Android Font Loading Textview
Helper for using custom fonts in styles
Ссылка на сайт

Ссылка на сайт

https://github.com/Kianoni/android-fontloading-textview
Система контроля версий

Система контроля версий

https://github.com/Kianoni/android-fontloading-textview

Скачать fontloader

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/net.kianoni/fontloader/ -->
<dependency>
    <groupId>net.kianoni</groupId>
    <artifactId>fontloader</artifactId>
    <version>0.3.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/net.kianoni/fontloader/
implementation 'net.kianoni:fontloader:0.3.0'
// https://jarcasting.com/artifacts/net.kianoni/fontloader/
implementation ("net.kianoni:fontloader:0.3.0")
'net.kianoni:fontloader:aar:0.3.0'
<dependency org="net.kianoni" name="fontloader" rev="0.3.0">
  <artifact name="fontloader" type="aar" />
</dependency>
@Grapes(
@Grab(group='net.kianoni', module='fontloader', version='0.3.0')
)
libraryDependencies += "net.kianoni" % "fontloader" % "0.3.0"
[net.kianoni/fontloader "0.3.0"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

android-fontloading-textview

Load custom fonts easily just via layout parameters or styles. Uses static Typeface objects, load once - memory efficient. No more textView.setTypeface() calls!

Android Arsenal

Add gradle dependency

compile 'net.kianoni:fontloader:0.3.0'

Usage in layouts

Please use styles.xml instead!

Add font namespace to xml root element, eg.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:font="http://schemas.android.com/apk/res-auto"

Define explicit font file to use:

<net.kianoni.fontloader.TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/hello_world"
    font:fontFile="fonts/OpenSans-Regular.ttf"
    android:textSize="18sp"
    />

Or a pattern, family and variant:

<net.kianoni.fontloader.TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/hello_world"
    font:fontFilePattern="fonts/{fontFamily}-{fontVariant}.ttf"
    font:fontFamily="OpenSans"
    font:fontVariant="Light"
    android:textSize="18sp"
    />

usage in styles

Example:

<resources xmlns:font="http://schemas.android.com/res/net.kianoni.fontloader">

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
    </style>

    <style name="OpenSans">
        <item name="fontFilePattern">fonts/{fontFamily}-{fontVariant}.ttf</item>
        <item name="fontFamily">OpenSans</item>
        <item name="fontVariant">Regular</item>
        <item name="android:textSize">18sp</item>
    </style>

    <style name="OpenSans.Bold" parent="OpenSans">
        <item name="fontVariant">Bold</item>
    </style>

</resources>

and usage in layouts:

<net.kianoni.fontloader.TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/hello_world"
    style="@style/OpenSans"
    />

<net.kianoni.fontloader.TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/hello_world"
    style="@style/OpenSans.Bold"
    />

Версии библиотеки

Версия
0.3.0