Jayakrishnan Salim
Jayakrishnan Salim

Reputation: 987

Canot resolve android.support.v7.internal.widget.TintImageView

I tried to set compileSdkVersion in my project to 23 and also updated the below libraries:

Since then I am getting error at importing android.support.v7.internal.widget.TintImageView

Can anyone please tell me why is it so? Any change in the package of TintImageView? Kindly help.

I am using Studio Preview 2.0

Upvotes: 6

Views: 2568

Answers (2)

Sakiboy
Sakiboy

Reputation: 7459

Use this for tinting an ImageView:

<android.support.v7.widget.AppCompatImageView
        android:id="@id/imageview"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/my_image"
        android:tint="#636363"
    />

Upvotes: 0

Gabriele Mariotti
Gabriele Mariotti

Reputation: 363737

It happens because the class

android.support.v7.internal.widget.TintImageView

doesn't exist in the appcompat v 23.x.x.

In general don't use the classes in the internal package.

You can check the source in the folder androidsdk\extras\android\m2repository\com\android\support\appcompat-v7\.

You should switch to the AppCompatImageView.

A ImageView which supports compatible features on older version of the platform, including:

  • Allows dynamic tint of it background via the background tint methods in ViewCompat.
  • Allows setting of the background tint using backgroundTint and backgroundTintMode.

This will automatically be used when you use ImageView in your layouts. You should only need to manually use this class when writing custom views.

Upvotes: 12

Related Questions