Raimundo Raimundo - 7 months ago 25
Java Question

Android ImageView contains two images instead of one

I have a ImageView with the following layout

<ImageView
android:id="@+id/view_row_circular_icon_with_text_icon"
style="@style/ImageView"
android:layout_width="52dp"
android:layout_height="52dp"
android:layout_gravity="right|center_vertical"
android:padding="5dp"
android:src="@drawable/ic_broadband_router_white"/>


The
android:src
property is useful for previewing this component.

And I set the image I want do display with the following

ImageView mIcon = (ImageView) findViewById(R.id.view_row_circular_icon_with_text_icon_bg);
mIcon.setImageDrawable(rowEntry.getIcon());


rowEntry.getIcon()
returns a Drawable.

The end result is both the image from
android:src
property and the image set from
mIcon.setImageDrawable()
in the ImageView.

How can I programmatically override the image so that only the latter is shown?

Answer

As i can see that your setting image of a another view which

R.id.view_row_circular_icon_with_text_icon_bg

Check the proper id and set the image

Comments