Hmm, well I could've sworn I tried this before but I seem to have fixed it. All the parents of my ImageView are set to wrap_content and this is how I have my ImageView:
<ImageView android:id="@+id/image_view" android:layout_width="wrap_content" android:layout_height="wrap_content" android:maxWidth="900px" android:maxHeight="369px" android:scaleType="fitCenter" android:adjustViewBounds="true" android:layout_centerInParent="true" /> But now I have a different problem. We have a semi-transparent overlay over the bottom of the image that shows the caption and photo credits. I'm doing this with a LinearLayout that's a sibling of the ImageView above (both are children of a RelativeLayout). Here's how that's declared: <LinearLayout android:id="@+id/caption_area" android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="#41000000" android:layout_alignBottom="@id/ image_view" android:layout_alignLeft="@id/image_view" android:layout_alignRight="@id/image_view" android:orientation="vertical" android:visibility="gone" android:gravity="center_vertical" android:padding="8px" android:minWidth="300px"> <TextView android:id="@+id/caption" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffffff" android:textSize="12px" android:textStyle="bold" android:visibility="gone" /> <TextView android:id="@+id/credit" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="#ffffffff" android:textSize="11px" android:textStyle="italic" android:visibility="gone" /> </LinearLayout> As you can see, it's set to alignLeft and alignRight of my ImageView so it takes up the full width. However, in a few rare cases we have very skinny images and the caption area ends up looking very squished. That's why I added the minWidth of 300px but it doesn't seem to respect it. Obviously I'm trying to tell Android to just magically figure out which one takes precedence but I can't think of another way to do it. So to sum up, I'd like my overlay to be the same width as the image, unless it's less than 300px. In that case, just keep it 300px. Is something like this possible? On Oct 12, 5:35 pm, Tim S <t...@schmidthole.com> wrote: > I want to scale and display images which are dynamically loaded to a > certain maximum size. The way I'm doing this is to set the > layout_width and layout_height of my ImageView to the maximum > dimensions and setting the scaleType to "fitCenter". > > But here's the problem. This is inside a RelativeLayout and I want to > show text directly under the image. In portrait mode, the text is way > at the bottom (because of the height I have set). So I want the > ImageView to scale down to the actual visible image size which is what > it would seem like adjustViewBounds="true" should do. > > Am I wrong in this assumption? Or is there a better way to do what > I'm trying to do? Because I've been unsuccessful to this point! > > Thanks, > tim -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en