如何均衡缩放图像按钮和imageview

时间:2015-03-15 03:07:04

标签: android android-layout android-studio

这里是完整的xml文件,但它们没有同等缩放

我的意思是说两个图像的宽度和高度分别为500像素,但如果屏幕分辨率为700像素,它们的平均分辨率不会达到350像素,我想实现它

<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"

    />

enter image description here

2 个答案:

答案 0 :(得分:1)

将您的imageview和图片按钮放在RelativeLayout中,并将ImageButton的宽度设置为match_parent,并将BackGround的{​​{1}}更改为ImageButton来自drawable

答案 1 :(得分:0)

你可以使用权重和。