本文介绍了在水平线性布局的两个图像视图。当我浏览一个图像。 Iv2放置正确,但iv1尺寸不适合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Two image view in horizontal linear layout. when i was browsed an image. iv2 placed properly Fit but iv1 size will not fit properly. How to solve?





我的尝试:





What I have tried:

<LinearLayout
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content"
                    android:layout_alignParentStart="true"
                    android:layout_alignParentTop="true"
                    android:orientation="horizontal"
                    android:weightSum="2"
                    tools:layout_editor_absoluteX="9dp"
                    tools:layout_editor_absoluteY="0dp">

                    <LinearLayout
                        android:layout_width="201dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:background="@drawable/border"
                        android:orientation="vertical"
                        tools:layout_editor_absoluteX="9dp"
                        tools:layout_editor_absoluteY="0dp">

                        <ImageView
                            android:id="@+id/iv_customer"
                            android:layout_width="match_parent"
                            android:layout_height="180dp"
                            android:layout_weight="1"
                            android:background="@drawable/vip_remark_border"
                            android:padding="20dip"
                            app:srcCompat="@drawable/gallery1" />

                        <Button
                            android:id="@+id/vip_cus_upload"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_margin="8dp"
                            android:background="#1B6E46"
                            android:text="Customer Photo"
                            android:textColor="@android:color/background_light"
                            android:textSize="12dp" />
                    </LinearLayout>

                    <LinearLayout
                        android:layout_width="201dp"
                        android:layout_height="wrap_content"
                        android:layout_weight="1"
                        android:orientation="vertical"
                        tools:layout_editor_absoluteX="9dp"
                        tools:layout_editor_absoluteY="0dp">


                        <ImageView
                            android:id="@+id/iv1_visit"
                            android:layout_width="match_parent"
                            android:layout_height="180dp"
                            android:layout_weight="1"
                            android:background="@drawable/vip_remark_border"
                            android:padding="20dip"
                            app:srcCompat="@drawable/gallery1" />

                        <Button
                            android:id="@+id/vip_card_upload"
                            android:layout_width="match_parent"
                            android:layout_height="match_parent"
                            android:layout_margin="8dp"
                            android:background="#1B6E46"
                            android:text="Visiting Card Upload"
                            android:textColor="@android:color/background_light"
                            android:textSize="12dp" />

                    </LinearLayout>
                </LinearLayout>

推荐答案

cus_upload.setScaleType(ImageView.ScaleType.FIT_CENTER);



我在java文件中添加了这一行,我得到了答案.. thankyou


I was add this line in java file and i got a answer.. thankyou


这篇关于在水平线性布局的两个图像视图。当我浏览一个图像。 Iv2放置正确,但iv1尺寸不适合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 05:38