Skip to content Skip to sidebar Skip to footer

Imageview Not Displaying Correctly In The Device

I have this layout that I want to use as a header for navigation bar:

Solution 1:

The answer is simple:

When in doubt, use android.support.v7.widget.AppCompatImageView

I thought that Android docs advising against its use in general was something to be taken seriously.

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.

Another place I read that you are supposed to be extending from AppCompatActivity to enable this behavior. My Activities DO extend from AppCompatActivity but still I spent so much time thinking that maybe something is buggy with ConstraintLayout after all.

NO. My belovedConstraintLayout hasn't lost its chivalry yet. :)

So, when in doubt, I reiterate,

Use android.support.v7.widget.AppCompatImageView


Some other answers saying the same thing:

Android vector drawable app:srcCompat not showing images

app:srcCompat does not work for ImageView

Post a Comment for "Imageview Not Displaying Correctly In The Device"