Giter Club home page Giter Club logo

Comments (7)

zhuzhuxiang avatar zhuzhuxiang commented on May 23, 2024 2
   //only required if you add a custom or generic font on your own
    Iconics.init(getApplicationContext());

    //register custom fonts like this (or also provide a font definition file)
    Iconics.registerFont(new Cniao5Font());

I'm registered
第一个TextView xml android:text="{ion-help-buoy}"

from android-iconics.

mikepenz avatar mikepenz commented on May 23, 2024

@zhuzhuxiang could you please provide more information?

How does the specified font look like? did you define the 3 character key as zhu?

Do you either register the font when you set up Iconics or have an initializer like the provided fonts?

Initializer:
https://github.com/mikepenz/Android-Iconics/blob/develop/meteocons-typeface-library/src/main/java/com/mikepenz/iconics/typeface/library/meteoconcs/Initializer.kt#L8-L17
https://github.com/mikepenz/Android-Iconics/blob/develop/meteocons-typeface-library/src/main/AndroidManifest.xml#L28-L30

from android-iconics.

zhuzhuxiang avatar zhuzhuxiang commented on May 23, 2024
      Drawable drawable_custom = new IconicsDrawable(this)
            .icon(Cniao5Font.Icon.zhu__denglong)
            .color(Color.GREEN)
            .sizeDp(150);

    ((ImageView) this.findViewById(R.id.image_custom)).setImageDrawable(drawable_custom);   √

  <TextView
       android:layout_width="50dp"
       android:layout_height="50dp"
       android:text="自定义字体{zhu_denglong}" />   ×

from android-iconics.

mikepenz avatar mikepenz commented on May 23, 2024

You duplicated the initial message. Please see my answer above :)

from android-iconics.

zhuzhuxiang avatar zhuzhuxiang commented on May 23, 2024

IMG_20211019_222211

 <TextView
      android:layout_width="50dp"
      android:layout_height="50dp"
      android:text="{ion-help-buoy}" />

  <ImageView
      android:id="@+id/image_view"
      android:layout_width="50dp"
      android:layout_height="50dp" />

  <TextView
      android:layout_width="50dp"
      android:layout_height="50dp"
      android:text="{zhu_denglong}" />

  <ImageView
      android:id="@+id/image_custom"
      android:layout_width="50dp"
      android:layout_height="50dp" />
 Drawable drawable = new IconicsDrawable(this)
                .icon(Ionicons.Icon.ion_android_add_circle)
                .color(Color.RED)
                .sizeDp(100);

        ((ImageView) this.findViewById(R.id.image_view)).setImageDrawable(drawable);


Drawable drawable_custom = new IconicsDrawable(this)
                .icon(Cniao5Font.Icon.zhu__denglong)
                .color(Color.GREEN)
                .sizeDp(100);

        ((ImageView) this.findViewById(R.id.image_custom)).setImageDrawable(drawable_custom);

The two imageviews and the first textview can be displayed. The second textview uses a custom font. I want to display icons in the form of {} like the first textview. I don't know what to do

zhu Defined. Ionicons class for custom font rewriting

   @Override
    public String getMappingPrefix() {    
        return "zhu";
    }     
    public enum Icon implements IIcon {
        zhu_gu('\ue60a'),
        zhu__chahu('\ue60b'),
        zhu__xianglu('\ue60c'),
        zhu__denglong('\ue60d'),
        zhu__fudao('\ue60e');

from android-iconics.

mikepenz avatar mikepenz commented on May 23, 2024

The Icon class enum should only have a single _ for the names.

See one off the icons provided from the library here:
https://github.com/mikepenz/Android-Iconics/blob/develop/meteocons-typeface-library/src/main/java/com/mikepenz/iconics/typeface/library/meteoconcs/Meteoconcs.kt

I also see you use Java. Only the latest version of the library is fully supported which is targeted for Kotlin.

from android-iconics.

saeed74 avatar saeed74 commented on May 23, 2024

thanks for this topic! registering my custom font in Application class was the thing that I forgot:

Iconics.init(getApplicationContext());
Iconics.registerFont( MaterialDesignIcon.INSTANCE );

from android-iconics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.