1

I'm developing an Android application and I'm having a very hard time showing a sample image here.

XML:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.xwaybill.xdriver2.HelpActivity"
android:background="#EAEAEA">

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:srcCompat="@drawable/footerlogo"
    android:layout_alignParentTop="true"
    android:id="@+id/imageView4"
    android:adjustViewBounds="true"
    android:elevation="21dp"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true" />

See image for result

I got the image in all the resolution folder in the resolution. This is not my first application and this one is an update of an old one. Since, I migrate form Android 3 to 6, I'm starting having this king of trouble. I also want to mention that I have the same exact image on an other Activity and it showing correctly.

Thank you.

Daniel
  • 35
  • 4

1 Answers1

0

First, in Build.gradle:

defaultConfig {
    vectorDrawables.useSupportLibrary = true
}

Second:

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    app:srcCompat="@drawable/XXXX"
    tools:ignore="MissingPrefix" />

Finally:

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

This article may helpful for you: Can't use srcCompat for ImageViews in android

Community
  • 1
  • 1
xxx
  • 3,315
  • 5
  • 21
  • 40
  • I already did this for the first activity, base on that article. It's not working here. Thx. – Daniel Aug 01 '16 at 19:10