[英]How to equally scale imagebutton and imageview
Here full xml file but they are not equally scaled 这里是完整的xml文件,但它们的缩放比例不同
I mean lets say both images are 500 px width and height however if screen resolution is 700 px they are not equally scaled to 350 px and i want to achieve it 我的意思是说两个图像的宽度和高度均为500 px,但是,如果屏幕分辨率为700 px,则它们不能均等地缩放为350 px,我想实现这一目标
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".Pokemon"
android:background="@drawable/pokemon_monstermmorpg_bg_land">>
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageView"
android:src="@drawable/application_text"
android:adjustViewBounds="true"
android:layout_centerInParent="true"
android:scaleType="centerInside"
/>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/imageButton_register"
android:background="@null"
android:src="@drawable/image_button"
android:adjustViewBounds="true"
android:scaleType="centerInside"
android:layout_below="@id/imageView"
android:layout_centerInParent="true"
/>
将您的imageview和imagebutton放在RelativeLayout
,并将ImageButton
的宽度设置为match_parent
并将ImageButton
的BackGround
从src
更改为drawable
您可以为此使用权重总和。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.