I have an Activity with gallery widget along with other views. I want the gallery to be as wide as my activity, and I want my image to fit the size of the gallery. I am a bit confused by ImageView.ScaleType , but this is what I selected:
Part of my gallery curtom adapter:
@Override public View getView(int position, View convertView, ViewGroup parent) { ImageView imageView=new ImageView(activity); imageView.setLayoutParams(new Gallery.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT)); imageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
Part of my activity layout:
<Gallery android:id="@+id/gallery" android:layout_below="@+id/tvDetailedDescription" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="#CCCCCC" />

I need to get rid of this extra gray part of the gallery above and below (marked in red). I wonder why it has such a size? Maybe I'm doing something funny with this type of scaling type?
source share