Search code examples
androidimagebuttonimagesource

setImageResource taking more space than original


onClick I am changing imageSource on a ImageButton

Originally it is like(see heart Icon)enter image description here after i change imageSource programmatically using search.setImageResource(R.drawable.linked); it looks like

enter image description here

 <ImageButton android:background="@drawable/favrouite"
        android:layout_height="36dp"
        android:layout_width="36dp"
        android:padding="10dp"
        android:onClick="click"
        android:layout_marginTop="10dp"
        android:id="@+id/button_fav"
        />

Yet Both the Images of same size on appllying programmatically differ
How can i resolve this Issue?
Please Help
Regards


Solution

  • I guess both image resolution are not same.Check your both image resolutions.