Android线性布局不会拉伸到全屏

3

你好,我正在为DroidX编写应用程序,它的分辨率是480x854。我按照以下方式设置了我的AVD:

目标:API级别7
皮肤:480x854
hw.lcd.density:160

就是这样。模拟器加载得很好,看起来很棒,但我的应用程序由于某种原因不能填满整个屏幕。请看这里:

alt text

它没有完全缩放,我不知道为什么。这是我的XML代码:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

<ImageView android:src="@drawable/logo_recruiting"
    android:background="#FF000000" 
    android:adjustViewBounds="true"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:padding="30dip" />

<LinearLayout android:orientation="vertical"
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent"
    android:layout_weight="1" 
    android:gravity="center"
    android:background="@drawable/menu_background">
    <Button android:layout_height="wrap_content"
        android:layout_width="wrap_content" 
        android:layout_marginBottom="25dip"
        android:text="@string/events"
        android:textColor="#FFFFFFFF"
        android:textSize="22dip"
        android:paddingBottom="5dip"
        android:background="@drawable/events_button"
        android:onClick="launchEventsMap"
        android:id="@+id/events_button"
        />
    <Button android:layout_height="wrap_content"
        android:layout_width="wrap_content" 
        android:layout_marginBottom="25dip"
        android:text="@string/jobs"
        android:textColor="#FFFFFFFF"
        android:textSize="22dip"
        android:paddingBottom="5dip"
        android:background="@drawable/jobs_button"
        android:id="@+id/jobs_button"
        />
    <Button android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_marginBottom="25dip" 
        android:text="@string/applicants"
        android:textColor="#FFFFFFFF"
        android:textSize="22dip"
        android:paddingBottom="5dip"
        android:background="@drawable/applicants_button"
        android:id="@+id/applicants_button"
        />
    <Button android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_marginBottom="25dip" 
        android:text="@string/resumes"
        android:textColor="#FFFFFFFF"
        android:textSize="22dip"
        android:paddingBottom="5dip"
        android:background="@drawable/resumes_button"
        android:id="@+id/resumes_button"
        />
    <Button android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:layout_marginBottom="25dip" 
        android:text="@string/settings"
        android:textColor="#FFFFFFFF"
        android:textSize="22dip"
        android:paddingBottom="5dip"
        android:background="@drawable/settings_button"
        android:id="@+id/settings_button"
        />
    </LinearLayout>
</LinearLayout>

我想layout_width="fill_parent"和layout_height="fill_parent"应该可以解决它... - Kevin Wu
2个回答

5

0

我认为这是因为你的ImageViewLinearLayout之外,也许尝试将整个内容包装在RelativeLayout中。


不,它是在之前的LinearLayout中的ImageView。 - Aurelien Ribon

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接