Android Studio裁剪紧密的PNG drawable具有较大的垂直边距

Android Studio裁剪紧密的PNG drawable具有较大的垂直边距,android,png,vertical-alignment,crop,pad,Android,Png,Vertical Alignment,Crop,Pad,这里没有。我有一个可绘制的PNG,只是围绕图像裁剪。没有垂直空白。当我将其覆盖在父级上时,将添加空白垂直边距: 我希望PNG显示时没有这些边距 在我的主要活动中,我使用 image = (ImageView) findViewById(R.id.imageView1); image.setImageResource(R.drawable.avalogo); <?xml version="1.0" encoding="utf-8"?> <RelativeLayo

这里没有。我有一个可绘制的PNG,只是围绕图像裁剪。没有垂直空白。当我将其覆盖在父级上时,将添加空白垂直边距:

我希望PNG显示时没有这些边距

在我的主要活动中,我使用

    image = (ImageView) findViewById(R.id.imageView1);
    image.setImageResource(R.drawable.avalogo);
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent"
    android:layout_height="match_parent"

    app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:showIn="@layout/app_bar_main"
    tools:context=".MainActivity">


    <ImageView
        android:id="@+id/imageView1"
        android:layout_alignTop="@id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/avalogo"
        android:padding="5px"
        />
</RelativeLayout>
在我的xml中,我使用

    image = (ImageView) findViewById(R.id.imageView1);
    image.setImageResource(R.drawable.avalogo);
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent"
    android:layout_height="match_parent"

    app:layout_behavior="@string/appbar_scrolling_view_behavior" tools:showIn="@layout/app_bar_main"
    tools:context=".MainActivity">


    <ImageView
        android:id="@+id/imageView1"
        android:layout_alignTop="@id/imageView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/avalogo"
        android:padding="5px"
        />
</RelativeLayout>


我什么都试过了,读了很多书。没有快乐。我用的是三星S6。TIA.

您尝试过将ViewBounds设置为true吗?我刚刚尝试过。谢谢你,佩德罗。就像冠军一样。你试过将ViewBounds设置为真吗?我刚试过。谢谢你,佩德罗。像冠军一样工作。