I have a layout with two ImageViews inside. Each image has a fixed aspect ratio, for example, the first image is 320x160, the second is 320x320. The layout is vertically aligned. I want these two images to be glued together and scaled to fit on one side of the screen (width or height), and scale the other side proprotionally. I tried using scaleType = fitCenter, but the problem is that on different phones with different aspect ratios the images are not combined, there is a black area between them. It seems that I cannot use the layout: weight because the screens have different ratios (480x854 and 480x800), and I need my layout to remain the same scaled proportion.
Any help is appreciated.
Here is my layout now:
<LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <ImageView android:src="@drawable/im_menu" android:adjustViewBounds="true" android:scaleType="fitCenter" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|top" android:layout_weight="0.7" > </ImageView> <ImageView android:src="@drawable/im_field" android:adjustViewBounds="true" android:scaleType="fitCenter" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_gravity="center_horizontal|top" android:layout_weight="0.3" > </ImageView> </LinearLayout>
source share