Android 4的位图宽度和高度

Android 4的位图宽度和高度,android,selector,drawable,android-4.0-ice-cream-sandwich,hdpi,Android,Selector,Drawable,Android 4.0 Ice Cream Sandwich,Hdpi,我在可绘制的hdpi中有carema.png和carema_sel.png图像,还有一个carema_btn.xml布局文件。在安卓2.2和2.3设备上,事情看起来很正常,但在安卓4.0中,按钮太大了。以下是我的布局: <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <i

我在可绘制的hdpi中有carema.png和carema_sel.png图像,还有一个carema_btn.xml布局文件。在安卓2.2和2.3设备上,事情看起来很正常,但在安卓4.0中,按钮太大了。以下是我的布局:

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

    <Button
        android:id="@+id/cameraButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:background="@drawable/camera_btn" />


为什么安卓4.0中的按钮显得太大?

您是否只有hdpi中的png图像? 如果要支持多种屏幕尺寸,还应提供图像的ldpi、mdpi和xhdpi版本

如果4.0设备的屏幕具有2.2/2.3设备以外的其他尺寸,则这可能是问题所在


查看

但我的应用程序只能在hdpi模式(480*800)下工作,4.0设备仍然错误(按钮太大),您找到了发生这种情况的原因吗?出于某种原因,在我的例子中,按钮的行为也是这样的,但textView很好。