Android 当我更换设备时,如何使我的3个ImageButton在页脚边水平对齐而不进行缩放?

Android 当我更换设备时,如何使我的3个ImageButton在页脚边水平对齐而不进行缩放?,android,button,android-studio,scale,android-layout-weight,Android,Button,Android Studio,Scale,Android Layout Weight,我有一个页脚,在那里我需要水平放置我的3个按钮(左、中、右-就像我把屏幕的宽度分成3块,每个按钮一块,但按钮之间有边距)。我需要把一个图像覆盖每个按钮,按钮应该有我的图像形状(不缩放)。我的问题是,我使用imagebuttons将图像放在每个按钮上,当我更改设备以查看其外观时,我会看到按钮缩放。这太烦人了,我真的不知道该怎么办。我使用加权和。我的代码是: <RelativeLayout android:id="@+id/footer" android:layout_wid

我有一个页脚,在那里我需要水平放置我的3个按钮(左、中、右-就像我把屏幕的宽度分成3块,每个按钮一块,但按钮之间有边距)。我需要把一个图像覆盖每个按钮,按钮应该有我的图像形状(不缩放)。我的问题是,我使用imagebuttons将图像放在每个按钮上,当我更改设备以查看其外观时,我会看到按钮缩放。这太烦人了,我真的不知道该怎么办。我使用加权和。我的代码是:

<RelativeLayout

    android:id="@+id/footer"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:padding="15dp"
    android:layout_alignParentBottom="true"
    android:background="@color/black">


    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:weightSum="3">


        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/imageButton1"
            android:background="@drawable/image1"
            android:layout_gravity="left"
            android:layout_marginRight="20dp"
            android:layout_weight="1"/>


        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/imageButton2"
            android:background="@drawable/image2"
            android:layout_gravity="left"
            android:layout_marginRight="20dp"
            android:layout_weight="1"/>


        <ImageButton
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:id="@+id/imageButton3"
            android:background="@drawable/image3"
            android:layout_gravity="right"
            android:layout_weight="1"/>


    </LinearLayout>


</RelativeLayout>

即使这样,在我当前的设备中,为了不看到缩放的图像,我必须在按钮之间放置特定的边距。我不确定它们是否在最后被缩放

我想一个解决方案,将使我能够有3个图像不缩放在任何设备,并有他们应该在每个设备的保证金,根据每个设备的大小


提前非常感谢

在第二个imageButton中,我的代码中有android:layou_gravity=“center”,而不是左:)推荐阅读:Hrundi V.Bakshi感谢链接。你知道如何根据密度调整图像大小吗?例如,假设我有一个23*56px的图像。我如何知道每个密度应该再创建多少像素?例如ldpi、mdpi、hdpi、xhdpi、xxhdpi、xxxhdpi?请让我知道,如果你知道,我有一个大问题。除此之外,您是否还知道是否有必要为小屏幕、普通屏幕、大屏幕和xlarge屏幕创建特定的绘图功能?我的意思是,它将为我的应用程序添加更多内容?长话短说:使用比例因子。从xxxhdpi图像大小开始并向下缩放。哪个是缩放因子?在第二个图像按钮中,我的代码中有android:layout_gravity=“center”,而不是左:)推荐阅读:Hrundi V.Bakshi感谢链接。你知道如何根据密度调整图像大小吗?例如,假设我有一个23*56px的图像。我如何知道每个密度应该再创建多少像素?例如ldpi、mdpi、hdpi、xhdpi、xxhdpi、xxxhdpi?请让我知道,如果你知道,我有一个大问题。除此之外,您是否还知道是否有必要为小屏幕、普通屏幕、大屏幕和xlarge屏幕创建特定的绘图功能?我的意思是,它将为我的应用程序添加更多内容?长话短说:使用比例因子。从xxxhdpi图像大小开始并向下缩放。哪个是缩放因子?