matsui Cao
matsui Cao

Reputation: 57

cant use VectorDrawableCompat in dependencied library

i'm using some library from maven, i already have this in gradle(Android Studio)

dependencies {
    //...other librarys
    compile 'com.android.support:recyclerview-v7:23.3.0'
    compile 'com.android.support:appcompat-v7:23.0.1'
}

I want to use this for compat VectorDrawable as src and background of ImageView on old sdk. but it seem like nothing work.

in layout xml:

xmlns:app="http://schemas.android.com/apk/res-auto"

and

<ImageView
        android:id="@+id/svg_head"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:srcCompat="@drawable/header"/>

it would be a unexpected namespace prefix app error, if i ignore(add tools:ignore attr), it could not be built successfully.

in java code:

i wanna do this for compat background 23.2.0 set vector drawable as background in 4.X

Drawable drawable = VectorDrawableCompat.create(getResources(), R.drawable.header, getTheme());

but class

VectorDrawableCompat

and

AppcompatDrawableManager

it can not find the class completely(only show red name, no any other prompt)

I used other library well, what happened about this???

Upvotes: 0

Views: 425

Answers (1)

Tim
Tim

Reputation: 43344

For VectorDrawableCompat and AppCompatDrawableManager, you need at least support library v23.2.0

So change to

compile 'com.android.support:appcompat-v7:23.2.0'

See this android develer blog post about how to further set it up with gradle.

Upvotes: 0

Related Questions