Not working with xml
Opened this issue · 16 comments
Added dependency
compile 'com.joanzapata.iconify:android-iconify-material:2.1.0'
compile 'com.joanzapata.iconify:android-iconify-fontawesome:2.1.0'
Added code in Application class
Iconify.with(new MaterialModule())
.with(new FontAwesomeModule());
<com.joanzapata.iconify.widget.IconTextView
android:layout_toRightOf="@+id/question_textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#fff"
android:text="{fa-heart-o}" />
I used this but i get ouptut as {fa-hear-o}
Xml not work for me too. I have success only with programmatically set icon.
I have use only material icons.This is my maven project dependency
<dependency>
<groupId>com.joanzapata.iconify</groupId>
<artifactId>android-iconify</artifactId>
<type>aar</type>
<version>2.1.0</version>
<exclusions>
<exclusion>
<groupId>com.android.support</groupId>
<artifactId>support-v4</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.joanzapata.iconify</groupId>
<artifactId>android-iconify-material</artifactId>
<type>aar</type>
<version>2.1.0</version>
<exclusions>
<exclusion>
<groupId>com.joanzapata.iconify</groupId>
<artifactId>android-iconify</artifactId>
</exclusion>
</exclusions>
</dependency>
In Application.java
Iconify.with(new MaterialModule());
layout.xml file:
<com.joanzapata.iconify.widget.IconTextView
android:id="@+id/bluetoothButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight=".2"
android:onClick="onBluetoothButton"
android:text="{md_bluetooth @dimen/main_button}"
android:shadowColor="#22000000"
android:shadowDx="3"
android:shadowDy="3"
android:shadowRadius="1"
android:textColor="#FFFFFFFF"/>
maybe related with this:
#110
@sytolk md_bluetooth
is invalid using v2, you're supposed to use md-bluetooth
.
@narendrakothamire Are you using an IconTextView
?
I think that its "_"
https://github.com/JoanZapata/android-iconify/blob/master/android-iconify-material/src/main/java/com/joanzapata/iconify/fonts/MaterialIcons.java#L75
I have copy in xml the same property like programmatically set:
new DrawerItem(getString(R.string.drawer_entry_home), MaterialIcons.md_home..
Or you replace "_" with "-" in library?
Read the file to the bottom.
The -
version is what keys look like in every icon font when you use them on the web and I wanted Iconify to work the same, but Java doesn't allow -
in names, so I had to use _
instead for the constants.
XML works for me with 2.1.0 version thanks @JoanZapata maybe Readme can be updated with this.
The - version is what keys look like in every icon font when you use them on the web and I wanted Iconify to work the same, but Java doesn't allow - in names, so I had to use _ instead for the constants.
I don't think that's needed. The README
uses -
already, the demo app too.
You're not supposed to use _
at all.
Yes I see that in README example have "-" instead of "_" but I think that programmers will believe what they see in the source code ;)
@JoanZapata Yes i am using IconTextView
XML Isn't working for me either.
@narendrakothamire Is you Application
subclass declared in your AndroidManifest.xml
?
I can't show icon in xml too.
please notice that, you should write
Iconify.with(new ....
before the
setContentView(R.....);
it is very important.
I can't show icon in xml too, is it a bug?
ok my bad, now i set new before setcontentview finally i can see the icon after i built and run the code, but there is no live preview in xml, is it alright?