Java 图像布局

Java 图像布局,java,android,xml,android-layout,android-xml,Java,Android,Xml,Android Layout,Android Xml,android xml中有我的布局,但图像不在布局的顶部。有什么问题吗 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_paren

android xml中有我的布局,但图像不在布局的顶部。有什么问题吗

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent">

    <ScrollView android:layout_width="match_parent"
                android:layout_height="match_parent">

        <LinearLayout android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:orientation="vertical">

            <ImageView android:id="@+id/description_imageview"
                       android:layout_width="match_parent"
                       android:layout_height="wrap_content"
                       android:src="@drawable/hand"
                       android:contentDescription="@string/app_version"/>

            <TextView android:id="@+id/first_help_textview"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:text="sdsjkfhsdjkfhsdkjfh skdfjh skjdfh skdjfh skjdfh skjdfh skjdhfk jshdfkjh  jskdfh skjdfh skdjfh skdjfh skdjfh skjdfh skjdfh skjdfh kjsdhf kjsdhfk jhs"/>
        </LinearLayout>
    </ScrollView>
</LinearLayout>


添加缩放类型:


可能是您的图像有空白,或者您可以说图像覆盖的某些区域为空

要么先裁剪图像,然后消除所有空白

 <ImageView android:id="@+id/description_imageview"
                   android:layout_width="match_parent"
                   android:layout_height="wrap_content"
                   android:src="@drawable/hand"
                   ***android:scaleType="fitXY"***
                   android:contentDescription="@string/app_version"/>

尝试将
scaleType
设置为您的ImageView

 android:scaleType="fitXY"
编辑:尝试更改线性布局高度:

<LinearLayout android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:orientation="vertical">



您想做什么?图像应该在顶部,但有一些空白。尝试过的android:adjustViewBounds attr?抱歉,这个答案没有帮助。它是缩放图像,比例不好…因此唯一的选择是,消除图像中的空白,尝试在paint或任何其他工具中打开图像以编辑和删除空白。在图像中没有空白。我已经编辑了一张图像。它显示有,正如您在缩放类型后显示的结果。发布您的图像我现在发布图像,请稍等。对不起,这个答案没有帮助。它是缩放图像,比例不好。您可以添加布局\u边距\u顶部属性
<ImageView android:id="@+id/description_imageview"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:src="@drawable/hand"
      android:contentDescription="@string/app_version"
      android:layout_marginTop="-5dp"
/>