Android图片适配

项目中需要实现五张图片如下排序


排序是这样只不过把图片换了一下,需要保证适配所有手机,不能出现拉伸效果,我只说我的实现方式,不喜勿喷。直接上代码

<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,这可以使小屏手机上下滑动来保证图片清晰,我的这个做法可能暴力了一些,要是哪位大神有好的办法,可以教教我。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值