Problems handling Vector Asset

Asked

Viewed 35 times

1

Android Studio is returning this error when I add images to my project, but the selected images are the native IDE icons.

inserir a descrição da imagem aqui

2 answers

0

You can set this value to default in your build.Radle:

defaultConfig{
   vectorDrawables.useSupportLibrary = true
}

and also puts appcompact in the dependencies:

dependencies {
  compile 'com.android.support:appcompat-v7:26.1.0'
}
  • <ImageView&#xA; android:id="@+id/imageAll"&#xA; android:layout_width="0dp"&#xA; android:layout_height="35dp"&#xA; android:layout_gravity="center_vertical"&#xA; android:layout_weight="1"&#xA; android:src="@drawable/ic_all_unselected"&#xA; android:tint="@color/menuItemUnselected"/> I was able to solve this way. Will q later give error again this way I did? This is good practice?

  • The way you did it is correct. You are setting the xml in drawable and then putting it as source in an imageview and setting the color. There’s nothing wrong with that and it’ll probably work smoothly! ;)

  • Thanks for your help :D

0

I managed to solve my problem this way. First I put the image so I can set its color. I hope it doesn’t give more problem :D

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.