Giter Site home page Giter Site logo

Comments (8)

donnfelker avatar donnfelker commented on June 10, 2024 9

@KennyGoers I ran into this issue as well (not using this lib, but through another problem in an app and found this page through GOOGLE). This looks to be solved if you use the AppCompatDrawableManager.get().getDrawable method source: https://code.google.com/p/android/issues/detail?id=213997

from ahbottomnavigation.

rmoreira0 avatar rmoreira0 commented on June 10, 2024 3

Hi @aurelhubert
I'm having the same problem:

android.content.res.Resources$NotFoundException: File res/drawable/ic_consumo.xml from drawable resource ID #0x7f02007c
                                                                                     at android.content.res.Resources.loadDrawable(Resources.java:2096)
                                                                                     at android.content.res.Resources.getDrawable(Resources.java:700)
                                                                                     at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:323)
                                                                                     at com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem.getDrawable(AHBottomNavigationItem.java:123)
                                                                                     at com.aurelhubert.ahbottomnavigation.AHBottomNavigation.createSmallItems(AHBottomNavigation.java:369)
                                                                                     at com.aurelhubert.ahbottomnavigation.AHBottomNavigation.createItems(AHBottomNavigation.java:200)
                                                                                     at com.aurelhubert.ahbottomnavigation.AHBottomNavigation.onSizeChanged(AHBottomNavigation.java:111)

and i think it's because of this:

android {
    defaultConfig {
        vectorDrawables.useSupportLibrary = true
    }
}

if i put vectorDrawables.useSupportLibrary equals false, everything works fine
How can I solve this?

Thanks

Update:

I solved the problem using this: VectorDrawableCompat.create(getResources(), R.drawable.ic_consumo, null)

from ahbottomnavigation.

KennyGoers avatar KennyGoers commented on June 10, 2024 1

the method: ContextCompat.getDrawable(context, drawableRes); running in the KitKat emulator and in 4.4 devices does not work for any vector resources I have tried. This is true in my own code as well as your library, using VectorDrawableCompat.create() corrected this in my own code, I have not tried the library yet

from ahbottomnavigation.

aurelhubert avatar aurelhubert commented on June 10, 2024

@victordigio It seems to work for me with the next vector drawable:

<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="24dp"
        android:height="24dp"
        android:viewportWidth="24.0"
        android:viewportHeight="24.0">
    <path
        android:fillColor="#FF000000"
        android:pathData="M4,8h4L8,4L4,4v4zM10,20h4v-4h-4v4zM4,20h4v-4L4,16v4zM4,14h4v-4L4,10v4zM10,14h4v-4h-4v4zM16,4v4h4L20,4h-4zM10,8h4L14,4h-4v4zM16,14h4v-4h-4v4zM16,20h4v-4h-4v4z"/>
</vector>

Can you give me more details about your implementation?

from ahbottomnavigation.

victordigio avatar victordigio commented on June 10, 2024

Library implementation:

// Create items
    AHBottomNavigationItem item1 = new AHBottomNavigationItem(R.string.menu_fav, R.drawable.bottom_fav, R.color.white);
    AHBottomNavigationItem item2 = new AHBottomNavigationItem(R.string.menu_trademarks, R.drawable.bottom_trademark, R.color.white);
    AHBottomNavigationItem item3 = new AHBottomNavigationItem(R.string.menu_chats, R.drawable.bottom_chat, R.color.white);

    // Add items
    mBottom.addItem(item1);
    mBottom.addItem(item2);
    mBottom.addItem(item3);

    // Change colors
    mBottom.setAccentColor(getResources().getColor(R.color.colorPrimary));
    mBottom.setForceTint(true);
    mBottom.setBehaviorTranslationEnabled(false);

    mBottom.setOnTabSelectedListener(this);

This is my bottom_fav.xml drawable vector:

<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="@dimen/bottom_image"
        android:height="@dimen/bottom_image"
        android:viewportWidth="351"
        android:viewportHeight="336">

<path
    android:fillColor="#007BFF"
    android:strokeWidth="1"
    android:pathData="M276.2,336 C274.2,336,272.2,335.5,270.4,334.6 L175.5,284.7    L80.6,334.6
C76.4,336.8,71.3,336.4,67.4,333.6 C63.6,330.8,61.6,326.1,62.4,321.4 L80.5,215.7
L3.8,140.8 C0.4,137.5,-0.8,132.5,0.6,128 C2.1,123.5,6,120.2,10.7,119.5
L116.8,104.1 L164.3,7.9 C166.4,3.6,170.8,0.9,175.5,0.9
C180.3,0.9,184.6,3.6,186.7,7.9 L234.2,104.1 L340.3,119.5
C345,120.2,348.9,123.5,350.4,128 C351.9,132.5,350.6,137.5,347.2,140.8
L270.4,215.6 L288.5,321.3 C289.3,326,287.4,330.7,283.5,333.5
C281.4,335.1,278.8,336,276.2,336 L276.2,336 L276.2,336 Z" />
</vector>

from ahbottomnavigation.

aurelhubert avatar aurelhubert commented on June 10, 2024

@victordigio Strange... everything works fine on Android 4.1.1 for me. Do you have more details? (gradle files, your Android version, etc.) Or can you share your project? Thanks.

from ahbottomnavigation.

aurelhubert avatar aurelhubert commented on June 10, 2024

@victordigio I close this ticket for now. Re-open it if you still have the problem, and share some code to test it! Thanks.

from ahbottomnavigation.

kenumir avatar kenumir commented on June 10, 2024

I have the same problem in my applications, using AppCompatDrawableManager does not help. A few times it happened on my device, but it was accidental, after the failure the app started up ok.
No way to reproduce the error.

from ahbottomnavigation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.