JoanZapata / android-iconify

Android integration of multiple icon providers such as FontAwesome, Entypo, Typicons,...
http://joanzapata.com/android-iconify
Other
3.93k stars 527 forks source link

Not working with xml #137

Open narendrakothamire opened 8 years ago

narendrakothamire commented 8 years ago

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}

sytolk commented 8 years ago

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: https://github.com/JoanZapata/android-iconify/issues/110

JoanZapata commented 8 years ago

@sytolk md_bluetooth is invalid using v2, you're supposed to use md-bluetooth. @narendrakothamire Are you using an IconTextView ?

sytolk commented 8 years ago

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?

JoanZapata commented 8 years ago

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.

sytolk commented 8 years ago

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.

JoanZapata commented 8 years ago

I don't think that's needed. The README uses - already, the demo app too. You're not supposed to use _ at all.

sytolk commented 8 years ago

Yes I see that in README example have "-" instead of "_" but I think that programmers will believe what they see in the source code ;)

narendrakothamire commented 8 years ago

@JoanZapata Yes i am using IconTextView

Plastix commented 8 years ago

XML Isn't working for me either.

JoanZapata commented 8 years ago

@narendrakothamire Is you Application subclass declared in your AndroidManifest.xml?

christiansoe commented 7 years ago

I can't show icon in xml too.

miladna7 commented 6 years ago

please notice that, you should write Iconify.with(new ....

before the
setContentView(R.....);

it is very important.

jhonoryza commented 6 years ago

I can't show icon in xml too, is it a bug?

miladna7 commented 6 years ago

No, i think you, New it after the setcontentview . U should new it before setting the layout for your activity.

On Aug 28, 2017 9:00 PM, "fajar sp" notifications@github.com wrote:

I can't show icon in xml too, is it a bug?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JoanZapata/android-iconify/issues/137#issuecomment-325403771, or mute the thread https://github.com/notifications/unsubscribe-auth/AHxb7O-T8MMhb0pKTLqfS838KsyD77Uyks5scusHgaJpZM4GdLnQ .

jhonoryza commented 6 years ago

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?

miladna7 commented 6 years ago

Oh, your welcoem dear. It was my problem for couple of days, too :))). Yep, there isn't any live view.

Now, they can close this.

On Aug 28, 2017 9:10 PM, "fajar sp" notifications@github.com wrote:

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?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/JoanZapata/android-iconify/issues/137#issuecomment-325406665, or mute the thread https://github.com/notifications/unsubscribe-auth/AHxb7P1zamjBtz2vUF9RIUGTHenp9-G3ks5scu2WgaJpZM4GdLnQ .