0

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???

Community
  • 1
  • 1
matsui Cao
  • 57
  • 1
  • 10

1 Answers1

0

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.

Tim
  • 41,901
  • 18
  • 127
  • 145
  • Ah...i update recyclerview but ignored this. But exception with NavigationView, so i update support.design too. And then i cant findviewbyid to the ImageView...What should I do further?(ImageView in a NavigationView as slid menu, all in mainactivity) – matsui Cao Jun 04 '16 at 01:35
  • @matsuiCao I don't know, that sounds like a different problem than what your question was about – Tim Jun 04 '16 at 08:32
  • thanks : ).btw, even you know, navigationView.getHeaderView(0).findviewbyid(R.id.xxx) to find a component in header of navigationview(app:headerlayout="layout/header" in xml) – matsui Cao Jun 04 '16 at 11:37