Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 27th, 2012  |  syntax: None  |  size: 0.74 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Android: Having problems with stretching/scaling on an image button
  2. ImageView img = (ImageButton) dialog.findViewById(R.id.fullsizeimage);
  3.           img.setScaleType(ImageView.ScaleType.CENTER_INSIDE);  //Changing ScaleType here has no effect
  4.           img.setImageBitmap(useThisBitmap);
  5.        
  6. <?xml version="1.0" encoding="utf-8"?>
  7.    <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  8.     android:orientation="vertical"
  9.     android:layout_width="fill_parent"
  10.     android:layout_height="fill_parent"
  11.     >
  12.  
  13. <ImageButton
  14.     android:id="@+id/fullsizeimage"
  15.     android:background="@null"
  16.     android:layout_width="wrap_content"
  17.     android:layout_height="fill_parent"
  18.     android:adjustViewBounds="true"
  19.     />
  20.  
  21.  </RelativeLayout>