ScrollView中的LinearLayout

Ver*_*ert 2 xml android scrollview android-layout

在这个xml中我试图显示7个ImageView,因此我使用的是ScrollView.但是,在模拟器中它不会完全显示第一个ImageView.只显示其下半部分.我该如何解决这个问题?

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

<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:background="@drawable/homescreen_bg">

    <LinearLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:orientation="vertical" >

        <ImageView
            android:id="@+id/header"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:contentDescription="@string/Homescreen_header"
            android:src="@drawable/logoheader" />

        <ImageView
            android:id="@+id/empinfo_logo"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_marginTop="10dp"
            android:contentDescription="@string/Homescreen_emp_info"
            android:src="@drawable/employee_info" />

        <ImageView
            android:id="@+id/leaveinfo_logo"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_marginTop="10dp"
            android:contentDescription="@string/Homescreen_leave_info"
            android:src="@drawable/leave_info" />

        <ImageView
            android:id="@+id/holidays_logo"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_marginTop="10dp"
            android:contentDescription="@string/Homescreen_holidays"
            android:src="@drawable/holidays" />

        <ImageView
            android:id="@+id/leavereq_logo"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_marginTop="10dp"
            android:contentDescription="@string/Homescreen_leave_req"
            android:src="@drawable/leave_request" />

        <ImageView
            android:id="@+id/leavestatus_logo"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_marginTop="10dp"
            android:contentDescription="@string/Homescreen_leave_status"
            android:src="@drawable/leave_status" />

        <ImageView
            android:id="@+id/logout"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_marginTop="10dp"
            android:contentDescription="@string/logout_button"
            android:src="@drawable/logout" />
    </LinearLayout>

</ScrollView>
Run Code Online (Sandbox Code Playgroud)

anj*_*nju 7

在LinearLayout中将android:layout_gravity ="center"更改为android:gravity ="center",并将所有ImageView的宽度和高度更改为"wrap_content".