Android 带有背景图像的按钮未按比例显示

Android 带有背景图像的按钮未按比例显示,android,xml,user-interface,Android,Xml,User Interface,这是我的可绘图文件夹ooo.png中的按钮图像文件: 这就是它在设备上的外观: 正如您所看到的,宽度-高度比例发生了变化。它比原版宽一点。 我需要它看起来是一样的 我不明白是什么导致了这种拉伸。这是我的xml文件: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_

这是我的可绘图文件夹ooo.png中的按钮图像文件:

这就是它在设备上的外观:

正如您所看到的,宽度-高度比例发生了变化。它比原版宽一点。 我需要它看起来是一样的

我不明白是什么导致了这种拉伸。这是我的xml文件:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >
        <Button
            android:id="@+id/button1"
            style="@style/styleBtns"
            android:layout_gravity="center_horizontal"
            android:layout_marginTop="50dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />

</LinearLayout>

My styleBtns是styles.xml的一部分:

    <style name="styleBtns" >
        <item name="android:background">@drawable/btns_abc</item>

    </style>

@可提取/BTN\U abc
在我的BTN_abc中,我将背景设置为我的图像资源。当前按下的状态与正常状态相同,我希望在其正常工作后立即进行更改:

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:drawable="@drawable/ooo" android:state_pressed="true"></item>
    <item android:drawable="@drawable/ooo"></item>

</selector>


谢谢

我不知道确切的原因,但是为了解决这个问题,如果你没有任何按钮的文本,使用ImageView将显示你添加的相同的可绘制内容。

使用ImageView,图像为src,背景透明…稍后我需要在这些按钮上添加文本。