Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image view (XML) doesn't work, cannot set icon via app:ico_icon #174

Closed
edesdan opened this issue May 16, 2016 · 4 comments
Closed

Image view (XML) doesn't work, cannot set icon via app:ico_icon #174

edesdan opened this issue May 16, 2016 · 4 comments
Assignees
Labels

Comments

@edesdan
Copy link

edesdan commented May 16, 2016

Hi,
I have just started to use the library in my project. I have followed all the steps described in the README section to include the google material icons and use them as icons sources for ImageView. Anyway it seems that it doesn't work at all. Here my code:

 <ImageView
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="48dp"
        android:layout_height="48dp"
        app:ico_icon="gmd-location-on"
        app:ico_color="@android:color/black"
        app:ico_size="48dp"/>

In my activity:

    /**
     * Define IconicsLayoutInflater to enable automatic xml icons detection
     * @param newBase
     */
    @Override
    protected void attachBaseContext(Context newBase) {
        super.attachBaseContext(IconicsContextWrapper.wrap(newBase));
    }

My gradle:

    compile 'com.mikepenz:iconics-core:2.5.11@aar'
    //Icons
    // Google Material Icons
    compile 'com.mikepenz:google-material-typeface:2.2.0.1@aar'
    //Font awesome
    compile 'com.mikepenz:fontawesome-typeface:4.6.0.1@aar'
    //Material icons
    compile 'com.mikepenz:material-design-iconic-typeface:2.2.0.1@aar'

Do I miss something?

@mikepenz
Copy link
Owner

mikepenz commented May 16, 2016

@edesdan any special logoutput you get?

I think you have the wrong dependency. You want the real Google Material Icons which are those:

compile 'com.mikepenz:google-material-typeface:2.2.0.1.original@aar'

(the .original)

You have the dependency for the Google Material Design Iconic typeface. which has similar icons but is handled by a different dev

@mikepenz mikepenz self-assigned this May 16, 2016
@edesdan
Copy link
Author

edesdan commented May 16, 2016

Hi, thanks for the suggestions but still same issue. Looking at the logs I can only find:

05-16 22:10:52.378  indian.fig.whatsaround  19083   -   E   Iconics      Wrong icon name: gmd_location_on 

Whats wrong with that? I think the name is correct.

@edesdan
Copy link
Author

edesdan commented May 16, 2016

ok I found a similar issue here: #67. Following the suggestion:

Iconics.init(getApplicationContext());
Iconics.registerFont(new GoogleMaterial());

the icon is finally displayed.

What I should do? Is that required or not?

Thanks a lot!

@mikepenz
Copy link
Owner

@edesdan it should be enough if you jsut register the font in your Application:

Iconics.registerFont(new GoogleMaterial());

It can happend that it won't be autodetected if you have a applicationId set in your gradle, or if you have proguard enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants