Closed jrm0695 closed 4 years ago
@jrm0695 you have to use fonts with the -kotlin
suffix with iconics v5
https://github.com/mikepenz/Android-Iconics#2-choose-your-desired-fonts
So
implementation 'com.mikepenz:material-design-iconic-typeface:2.2.0.6-kotlin@aar'
should work for you. 2.2..0.7 will require iconics 5.1.0
Hey @mikepenz thank you so much for your reactivity. After I read the readme, it is said for androidx users, version is 3.2.5. So I modified to :
implementation "com.mikepenz:iconics-core:3.2.5"
implementation "com.mikepenz:iconics-views:3.2.5"
implementation 'com.mikepenz:material-design-iconic-typeface:2.2.0.6-kotlin@aar'`
After I do that, I created a button like this :
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/button_0"
android:layout_width="wrap_content"
android:text="{gmi_done} HELLO"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" />
and I wrote this to try to make it work in the main activity :
Iconics.init(this);
button = findViewById(R.id.button_0);
new Iconics.IconicsBuilder().style(new ForegroundColorSpan(0xffff0000)).on(button).build();
But the button displays "{gmi_done} HELLO" so it doesn't work :/
for v3 of the library you have to use the old font, which you had before :)
the font addons have to match the iconics version
Just see the versions at that state herE: https://github.com/mikepenz/Android-Iconics/tree/v3.2.5
Thanks for your answer, I'm new to github, didn't know I could switch btw versions :) So, unfortunately, I used the right font version for core version 3.2.5 :
implementation "com.mikepenz:iconics-core:3.2.5"
implementation "com.mikepenz:iconics-views:3.2.5"
implementation 'com.mikepenz:material-design-iconic-typeface:2.2.0.5@aar'
which is what is recommanded in the link, but now when I do :
AppCompatButton button ;
button = findViewById(R.id.button_0);
new Iconics.IconicsBuilder().style(new ForegroundColorSpan(0xffff0000)).on(button).build();
I have a new exception coming :
"Attempt to invoke virtual method 'int android.graphics.Typeface.getStyle()' on a null object reference"
Maybe the 3.2.5 is too old and I should go to version 5 instead ? I have to admit I have no idea what to do ...
EDIT : tried version 4.0.2 this one works with the recommended fonts 👍
I don't manage to have the librairy work despite several hours of research. Whatever version I use, it always end up with this exception when I use .build method :
Caused by: java.lang.AbstractMethodError: abstract method "android.graphics.Typeface com.mikepenz.iconics.typeface.ITypeface.getRawTypeface()"
I'm using a project in java. I implemented lastest version of the librairy, as proposed by Android Studio :
implementation "com.mikepenz:iconics-core:5.0.2"; implementation 'com.mikepenz:material-design-iconic-typeface:2.2.0.5@aar'` Here is how I use it : new Iconics.Builder().style(new ForegroundColorSpan(colorText)).on(myButton).build();
myButton is an AppCompatButton. Here is my implementation of AppCompat :
implementation 'androidx.appcompat:appcompat:1.3.0-alpha02' Has anyone any idea ? I checked that I wasn't alone having this issue but I didn't understand very well the answers (is it a problem with my typeface version 2.2.0.5 that isn't compatible with the core v5.0.2 ? )
Thank you