I have something strange in here. I have the very same image being loaded in two different ways:
Here is the code:
if(imageAddress.startsWith("drawable")){
btn.setImageResource(this.getResources().getIdentifier(imageAddress, null, this.getPackageName()));
}else{
btn.setImageURI(Uri.parse(new File(imageAddress).toString()));
}
As you can see above, I test if the image address begins with "drawable", if it does, then I load the image as a drawable. If it doesn't, then it's an image from sdcard, then I load it through its URI.
Here is the code for the ImageButton:
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/roundcorners"
android:scaleType="centerInside"
android:cropToPadding="false"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingBottom="10dip"
android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:layout_weight=".95">
</ImageButton>
And below is the RESULT of this:
Above image shows ImageButton when loaded AS DRAWABLE (imageAddress = "drawable/eu_quero")
Above image shows ImageButton when loaded THROUGH IMAGE URI (imageAddress = "/mnt/sdcard/myapp/images/eu_quero.png")
What I need is the images to be the same size, no matter if I load it as drawable or through ImageURI.
Can anyone help me please??
IMPORTANT: IMAGES ARE EXACTLY THE SAME!!! SAME SIZE!!
Can you try implementing android:margin_left instead of padding:left ?