android-iconify icon indicating copy to clipboard operation
android-iconify copied to clipboard

Not working with xml

Open narendrakothamire opened this issue 9 years ago • 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}

narendrakothamire avatar Nov 06 '15 05:11 narendrakothamire

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

sytolk avatar Nov 06 '15 12:11 sytolk

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

JoanZapata avatar Nov 06 '15 13:11 JoanZapata

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?

sytolk avatar Nov 06 '15 14:11 sytolk

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.

JoanZapata avatar Nov 06 '15 14:11 JoanZapata

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.

sytolk avatar Nov 06 '15 14:11 sytolk

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

JoanZapata avatar Nov 06 '15 14:11 JoanZapata

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

sytolk avatar Nov 06 '15 14:11 sytolk

@JoanZapata Yes i am using IconTextView

narendrakothamire avatar Nov 07 '15 13:11 narendrakothamire

XML Isn't working for me either.

Plastix avatar Nov 08 '15 22:11 Plastix

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

JoanZapata avatar Nov 20 '15 13:11 JoanZapata

I can't show icon in xml too.

christiansoe avatar Feb 27 '17 17:02 christiansoe

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

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

it is very important.

miladna7 avatar Aug 28 '17 11:08 miladna7

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

jhonoryza avatar Aug 28 '17 16:08 jhonoryza

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" [email protected] 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 .

miladna7 avatar Aug 28 '17 16:08 miladna7

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?

jhonoryza avatar Aug 28 '17 16:08 jhonoryza

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" [email protected] 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 .

miladna7 avatar Aug 28 '17 16:08 miladna7