项目中需要实现五张图片如下排序
排序是这样只不过把图片换了一下,需要保证适配所有手机,不能出现拉伸效果,我只说我的实现方式,不喜勿喷。直接上代码
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/meinv_1"
android:layout_marginTop="10dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitStart"
android:adjustViewBounds="true"
android:layout_alignParentTop="true"
android:src="@mipmap/meinv_1" />
<LinearLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/meinv_1"
android:layout_alignLeft="@id/meinv_1"
android:layout_alignRight="@id/meinv_1"
android:layout_marginTop="10dp">
<LinearLayout
android:layout_marginRight="10dp"
android:orientation="vertical"
android:layout_weight="300"
android:layout_width="0dp"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/meinv_2"
android:scaleType="fitStart"
android:adjustViewBounds="true"
android:src="@mipmap/meinv_2"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ImageView
android:id="@+id/meinv_3"
android:layout_marginTop="10dp"
android:scaleType="fitStart"
android:adjustViewBounds="true"
android:src="@mipmap/meinv_3"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
android:orientation="vertical"
android:layout_weight="280"
android:layout_width="0dp"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/meinv_4"
android:scaleType="fitStart"
android:adjustViewBounds="true"
android:src="@mipmap/meinv_4"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<ImageView
android:layout_marginTop="10dp"
android:scaleType="fitStart"
android:adjustViewBounds="true"
android:src="@mipmap/meinv_5"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/meinv_5" />
</LinearLayout>
</LinearLayout>
</RelativeLayout>
</LinearLayout>
</ScrollView>
将图片放出来
五张图片的尺寸为:最上面的600 x 220;左上300 x 390;左下300 x 210;右上280 x 240;右下280 x 360;
我在最外层添加了Scroll,这可以使小屏手机上下滑动来保证图片清晰,我的这个做法可能暴力了一些,要是哪位大神有好的办法,可以教教我。